Skip to content

Commit

Permalink
Update baselines
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbranch committed Jan 9, 2020
1 parent 0547a3d commit 124dcd6
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
/b.ts(1,1): error TS1371: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
/c.ts(1,1): error TS1371: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
/e.ts(1,1): error TS6192: All imports in import declaration are unused.
/g.ts(1,1): error TS1371: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.


==== /a.ts (0 errors) ====
export default class {}
export class A {}
export type B = {};
export const enum C { One, Two }

==== /b.ts (1 errors) ====
import { A, B } from './a'; // Error
Expand Down Expand Up @@ -34,4 +36,19 @@
import { A, B } from './a'; // noUnusedLocals error only
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS6192: All imports in import declaration are unused.


==== /f.ts (0 errors) ====
import { C } from './a';
import type { C as D } from './a';
C.One;
let c: D = C.Two;
let d: D.Two = C.Two;
console.log(c, d);

==== /g.ts (1 errors) ====
import { C } from './a';
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1371: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
let c: C;
let d: C.Two;
console.log(c, d);
29 changes: 29 additions & 0 deletions tests/baselines/reference/importsNotUsedAsValues_error.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
export default class {}
export class A {}
export type B = {};
export const enum C { One, Two }

//// [b.ts]
import { A, B } from './a'; // Error
Expand All @@ -26,6 +27,19 @@ console.log(a, b);
//// [e.ts]
import { A, B } from './a'; // noUnusedLocals error only

//// [f.ts]
import { C } from './a';
import type { C as D } from './a';
C.One;
let c: D = C.Two;
let d: D.Two = C.Two;
console.log(c, d);

//// [g.ts]
import { C } from './a';
let c: C;
let d: C.Two;
console.log(c, d);

//// [a.js]
"use strict";
Expand Down Expand Up @@ -67,3 +81,18 @@ console.log(a, b);
"use strict";
exports.__esModule = true;
require("./a"); // noUnusedLocals error only
//// [f.js]
"use strict";
exports.__esModule = true;
require("./a");
0 /* One */;
var c = 1 /* Two */;
var d = 1 /* Two */;
console.log(c, d);
//// [g.js]
"use strict";
exports.__esModule = true;
require("./a");
var c;
var d;
console.log(c, d);
60 changes: 60 additions & 0 deletions tests/baselines/reference/importsNotUsedAsValues_error.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ export class A {}
export type B = {};
>B : Symbol(B, Decl(a.ts, 1, 17))

export const enum C { One, Two }
>C : Symbol(C, Decl(a.ts, 2, 19))
>One : Symbol(C.One, Decl(a.ts, 3, 21))
>Two : Symbol(C.Two, Decl(a.ts, 3, 26))

=== /b.ts ===
import { A, B } from './a'; // Error
>A : Symbol(A, Decl(b.ts, 0, 8))
Expand Down Expand Up @@ -72,3 +77,58 @@ import { A, B } from './a'; // noUnusedLocals error only
>A : Symbol(A, Decl(e.ts, 0, 8))
>B : Symbol(B, Decl(e.ts, 0, 11))

=== /f.ts ===
import { C } from './a';
>C : Symbol(C, Decl(f.ts, 0, 8))

import type { C as D } from './a';
>C : Symbol(C, Decl(a.ts, 2, 19))
>D : Symbol(D, Decl(f.ts, 1, 13))

C.One;
>C.One : Symbol(C.One, Decl(a.ts, 3, 21))
>C : Symbol(C, Decl(f.ts, 0, 8))
>One : Symbol(C.One, Decl(a.ts, 3, 21))

let c: D = C.Two;
>c : Symbol(c, Decl(f.ts, 3, 3))
>D : Symbol(D, Decl(f.ts, 1, 13))
>C.Two : Symbol(C.Two, Decl(a.ts, 3, 26))
>C : Symbol(C, Decl(f.ts, 0, 8))
>Two : Symbol(C.Two, Decl(a.ts, 3, 26))

let d: D.Two = C.Two;
>d : Symbol(d, Decl(f.ts, 4, 3))
>D : Symbol(D, Decl(f.ts, 1, 13))
>Two : Symbol(C.Two, Decl(a.ts, 3, 26))
>C.Two : Symbol(C.Two, Decl(a.ts, 3, 26))
>C : Symbol(C, Decl(f.ts, 0, 8))
>Two : Symbol(C.Two, Decl(a.ts, 3, 26))

console.log(c, d);
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>c : Symbol(c, Decl(f.ts, 3, 3))
>d : Symbol(d, Decl(f.ts, 4, 3))

=== /g.ts ===
import { C } from './a';
>C : Symbol(C, Decl(g.ts, 0, 8))

let c: C;
>c : Symbol(c, Decl(g.ts, 1, 3))
>C : Symbol(C, Decl(g.ts, 0, 8))

let d: C.Two;
>d : Symbol(d, Decl(g.ts, 2, 3))
>C : Symbol(C, Decl(g.ts, 0, 8))
>Two : Symbol(C.Two, Decl(a.ts, 3, 26))

console.log(c, d);
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>c : Symbol(c, Decl(g.ts, 1, 3))
>d : Symbol(d, Decl(g.ts, 2, 3))

58 changes: 58 additions & 0 deletions tests/baselines/reference/importsNotUsedAsValues_error.types
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ export class 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
Expand Down Expand Up @@ -70,3 +75,56 @@ 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 : (message?: any, ...optionalParams: any[]) => void
>console : Console
>log : (message?: any, ...optionalParams: 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 : (message?: any, ...optionalParams: any[]) => void
>console : Console
>log : (message?: any, ...optionalParams: any[]) => void
>c : C
>d : C.Two

0 comments on commit 124dcd6

Please sign in to comment.