TypeScript/tests/baselines/reference/importsNotUsedAsValues_error.types
Andrew Branch 69bc3f3b0c
Allow type-only imports on ImportEqualsDeclarations (#41573)
* Allow type-only ImportEqualsDeclarations

* Suppress CJS-in-ESM error when type-only

* Add grammar error on import type in import alias

* Update API baselines

* Fix importsNotUsedAsValues with ImportEqualsDeclarations

* Make bad error talk words more good for Daniel. Fixes #41603

* One more error message baseline update

* Update transformer and emitter
2020-12-03 13:27:15 -08:00

176 lines
2.8 KiB
Plaintext

=== /a.ts ===
export default class {}
export class A {}
>A : A
export type B = {};
>B : B
export const enum C { One, Two }
>C : C
>One : C.One
>Two : C.Two
=== /b.ts ===
import { A, B } from './a'; // Error
>A : typeof A
>B : any
let a: A;
>a : A
let b: B;
>b : B
console.log(a, b);
>console.log(a, b) : void
>console.log : (...data: any[]) => void
>console : Console
>log : (...data: any[]) => void
>a : A
>b : B
=== /c.ts ===
import Default, * as named from './a'; // Error
>Default : typeof Default
>named : typeof named
let a: Default;
>a : Default
let b: named.B;
>b : named.B
>named : any
console.log(a, b);
>console.log(a, b) : void
>console.log : (...data: any[]) => void
>console : Console
>log : (...data: any[]) => void
>a : Default
>b : named.B
=== /d.ts ===
import Default, { A } from './a';
>Default : typeof Default
>A : typeof A
const a = A;
>a : typeof A
>A : typeof A
let b: Default;
>b : Default
console.log(a, b);
>console.log(a, b) : void
>console.log : (...data: any[]) => void
>console : Console
>log : (...data: any[]) => void
>a : typeof A
>b : Default
=== /e.ts ===
import { A, B } from './a'; // noUnusedLocals error only
>A : typeof A
>B : any
=== /f.ts ===
import { C } from './a';
>C : typeof C
import type { C as D } from './a';
>C : typeof C
>D : C
C.One;
>C.One : C.One
>C : typeof C
>One : C.One
let c: D = C.Two;
>c : C
>C.Two : C.Two
>C : typeof C
>Two : C.Two
let d: D.Two = C.Two;
>d : C.Two
>D : any
>C.Two : C.Two
>C : typeof C
>Two : C.Two
console.log(c, d);
>console.log(c, d) : void
>console.log : (...data: any[]) => void
>console : Console
>log : (...data: any[]) => void
>c : C.Two
>d : C.Two
=== /g.ts ===
import { C } from './a';
>C : typeof C
let c: C;
>c : C
let d: C.Two;
>d : C.Two
>C : any
console.log(c, d);
>console.log(c, d) : void
>console.log : (...data: any[]) => void
>console : Console
>log : (...data: any[]) => void
>c : C
>d : C.Two
=== /h.ts ===
class H {}
>H : H
export = H;
>H : H
=== /i.ts ===
import H = require('./h'); // Error
>H : typeof H
let h: H = {};
>h : H
>{} : {}
console.log(h);
>console.log(h) : void
>console.log : (...data: any[]) => void
>console : Console
>log : (...data: any[]) => void
>h : H
=== /j.ts ===
import H = require('./h'); // noUnusedLocals error only
No type information for this code.
No type information for this code.=== /k.ts ===
const enum K { One, Two }
>K : K
>One : K.One
>Two : K.Two
export = K;
>K : K
=== /l.ts ===
import K = require('./k');
>K : typeof K
K.One;
>K.One : K.One
>K : typeof K
>One : K.One
=== /j.ts ===
// Sad face https://github.com/microsoft/TypeScript/blob/6b04f5039429b9d412696fe2febe39ecc69ad365/src/testRunner/compilerRunner.ts#L207
No type information for this code.