-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
acbee11
commit ab31628
Showing
6 changed files
with
182 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
tests/baselines/reference/importClause_namespaceImport.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/b.ts(2,1): error TS2708: Cannot use namespace 'types' as a value. | ||
/b.ts(3,1): error TS2708: Cannot use namespace 'types' as a value. | ||
/b.ts(4,14): error TS2694: Namespace '"/a"' has no exported member 'Value'. | ||
/b.ts(5,7): error TS2741: Property 'a' is missing in type '{}' but required in type 'A'. | ||
/b.ts(6,7): error TS2741: Property 'b' is missing in type '{}' but required in type 'B'. | ||
|
||
|
||
==== /a.ts (0 errors) ==== | ||
export class A { a!: string } | ||
export class B { b!: number } | ||
export type C<T> = T; | ||
export const Value = {}; | ||
|
||
==== /b.ts (5 errors) ==== | ||
import type * as types from './a'; | ||
types; | ||
~~~~~ | ||
!!! error TS2708: Cannot use namespace 'types' as a value. | ||
types.Value; | ||
~~~~~ | ||
!!! error TS2708: Cannot use namespace 'types' as a value. | ||
let v: types.Value; | ||
~~~~~ | ||
!!! error TS2694: Namespace '"/a"' has no exported member 'Value'. | ||
const a: types.A = {}; | ||
~ | ||
!!! error TS2741: Property 'a' is missing in type '{}' but required in type 'A'. | ||
!!! related TS2728 /a.ts:1:18: 'a' is declared here. | ||
const b: types.B = {}; | ||
~ | ||
!!! error TS2741: Property 'b' is missing in type '{}' but required in type 'B'. | ||
!!! related TS2728 /a.ts:2:18: 'b' is declared here. | ||
const c: types.C<string> = ""; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//// [tests/cases/conformance/externalModules/typeOnly/importClause_namespaceImport.ts] //// | ||
|
||
//// [a.ts] | ||
export class A { a!: string } | ||
export class B { b!: number } | ||
export type C<T> = T; | ||
export const Value = {}; | ||
|
||
//// [b.ts] | ||
import type * as types from './a'; | ||
types; | ||
types.Value; | ||
let v: types.Value; | ||
const a: types.A = {}; | ||
const b: types.B = {}; | ||
const c: types.C<string> = ""; | ||
|
||
|
||
//// [a.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var A = /** @class */ (function () { | ||
function A() { | ||
} | ||
return A; | ||
}()); | ||
exports.A = A; | ||
var B = /** @class */ (function () { | ||
function B() { | ||
} | ||
return B; | ||
}()); | ||
exports.B = B; | ||
exports.Value = {}; | ||
//// [b.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
types; | ||
types.Value; | ||
var v; | ||
var a = {}; | ||
var b = {}; | ||
var c = ""; |
42 changes: 42 additions & 0 deletions
42
tests/baselines/reference/importClause_namespaceImport.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
=== /a.ts === | ||
export class A { a!: string } | ||
>A : Symbol(A, Decl(a.ts, 0, 0)) | ||
>a : Symbol(A.a, Decl(a.ts, 0, 16)) | ||
|
||
export class B { b!: number } | ||
>B : Symbol(B, Decl(a.ts, 0, 29)) | ||
>b : Symbol(B.b, Decl(a.ts, 1, 16)) | ||
|
||
export type C<T> = T; | ||
>C : Symbol(C, Decl(a.ts, 1, 29)) | ||
>T : Symbol(T, Decl(a.ts, 2, 14)) | ||
>T : Symbol(T, Decl(a.ts, 2, 14)) | ||
|
||
export const Value = {}; | ||
>Value : Symbol(Value, Decl(a.ts, 3, 12)) | ||
|
||
=== /b.ts === | ||
import type * as types from './a'; | ||
>types : Symbol(types, Decl(b.ts, 0, 11)) | ||
|
||
types; | ||
types.Value; | ||
let v: types.Value; | ||
>v : Symbol(v, Decl(b.ts, 3, 3)) | ||
>types : Symbol(types, Decl(b.ts, 0, 11)) | ||
|
||
const a: types.A = {}; | ||
>a : Symbol(a, Decl(b.ts, 4, 5)) | ||
>types : Symbol(types, Decl(b.ts, 0, 11)) | ||
>A : Symbol(types.A) | ||
|
||
const b: types.B = {}; | ||
>b : Symbol(b, Decl(b.ts, 5, 5)) | ||
>types : Symbol(types, Decl(b.ts, 0, 11)) | ||
>B : Symbol(types.B) | ||
|
||
const c: types.C<string> = ""; | ||
>c : Symbol(c, Decl(b.ts, 6, 5)) | ||
>types : Symbol(types, Decl(b.ts, 0, 11)) | ||
>C : Symbol(types.C, Decl(a.ts, 1, 29)) | ||
|
47 changes: 47 additions & 0 deletions
47
tests/baselines/reference/importClause_namespaceImport.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
=== /a.ts === | ||
export class A { a!: string } | ||
>A : A | ||
>a : string | ||
|
||
export class B { b!: number } | ||
>B : B | ||
>b : number | ||
|
||
export type C<T> = T; | ||
>C : T | ||
|
||
export const Value = {}; | ||
>Value : {} | ||
>{} : {} | ||
|
||
=== /b.ts === | ||
import type * as types from './a'; | ||
>types : any | ||
|
||
types; | ||
>types : any | ||
|
||
types.Value; | ||
>types.Value : any | ||
>types : any | ||
>Value : any | ||
|
||
let v: types.Value; | ||
>v : any | ||
>types : any | ||
|
||
const a: types.A = {}; | ||
>a : import("/a").A | ||
>types : any | ||
>{} : {} | ||
|
||
const b: types.B = {}; | ||
>b : import("/a").B | ||
>types : any | ||
>{} : {} | ||
|
||
const c: types.C<string> = ""; | ||
>c : string | ||
>types : any | ||
>"" : "" | ||
|
14 changes: 14 additions & 0 deletions
14
tests/cases/conformance/externalModules/typeOnly/importClause_namespaceImport.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// @Filename: /a.ts | ||
export class A { a!: string } | ||
export class B { b!: number } | ||
export type C<T> = T; | ||
export const Value = {}; | ||
|
||
// @Filename: /b.ts | ||
import type * as types from './a'; | ||
types; | ||
types.Value; | ||
let v: types.Value; | ||
const a: types.A = {}; | ||
const b: types.B = {}; | ||
const c: types.C<string> = ""; |