diff --git a/tests/baselines/reference/errorForUsingPropertyOfTypeAsType01.errors.txt b/tests/baselines/reference/errorForUsingPropertyOfTypeAsType01.errors.txt new file mode 100644 index 00000000000..3285fe6a1d6 --- /dev/null +++ b/tests/baselines/reference/errorForUsingPropertyOfTypeAsType01.errors.txt @@ -0,0 +1,55 @@ +tests/cases/compiler/errorForUsingPropertyOfTypeAsType01.ts(6,12): error TS2702: 'Foo' only refers to a type, but is being used as a namespace here. +tests/cases/compiler/errorForUsingPropertyOfTypeAsType01.ts(14,12): error TS2503: Cannot find namespace 'Foo'. +tests/cases/compiler/errorForUsingPropertyOfTypeAsType01.ts(22,12): error TS2702: 'Foo' only refers to a type, but is being used as a namespace here. +tests/cases/compiler/errorForUsingPropertyOfTypeAsType01.ts(29,12): error TS2702: 'Foo' only refers to a type, but is being used as a namespace here. +tests/cases/compiler/errorForUsingPropertyOfTypeAsType01.ts(36,12): error TS2702: 'Foo' only refers to a type, but is being used as a namespace here. + + +==== tests/cases/compiler/errorForUsingPropertyOfTypeAsType01.ts (5 errors) ==== + namespace Test1 { + export interface Foo { + bar: string; + } + + var x: Foo.bar = ""; + ~~~ +!!! error TS2702: 'Foo' only refers to a type, but is being used as a namespace here. + } + + namespace Test2 { + export class Foo { + bar: string; + } + + var x: Foo.bar = ""; + ~~~ +!!! error TS2503: Cannot find namespace 'Foo'. + } + + namespace Test3 { + export type Foo = { + bar: string; + } + + var x: Foo.bar = ""; + ~~~ +!!! error TS2702: 'Foo' only refers to a type, but is being used as a namespace here. + } + + namespace Test4 { + export type Foo = { bar: number } + | { bar: string } + + var x: Foo.bar = ""; + ~~~ +!!! error TS2702: 'Foo' only refers to a type, but is being used as a namespace here. + } + + namespace Test5 { + export type Foo = { bar: number } + | { wat: string } + + var x: Foo.bar = ""; + ~~~ +!!! error TS2702: 'Foo' only refers to a type, but is being used as a namespace here. + } \ No newline at end of file diff --git a/tests/baselines/reference/errorForUsingPropertyOfTypeAsType01.js b/tests/baselines/reference/errorForUsingPropertyOfTypeAsType01.js new file mode 100644 index 00000000000..8a70396880b --- /dev/null +++ b/tests/baselines/reference/errorForUsingPropertyOfTypeAsType01.js @@ -0,0 +1,66 @@ +//// [errorForUsingPropertyOfTypeAsType01.ts] +namespace Test1 { + export interface Foo { + bar: string; + } + + var x: Foo.bar = ""; +} + +namespace Test2 { + export class Foo { + bar: string; + } + + var x: Foo.bar = ""; +} + +namespace Test3 { + export type Foo = { + bar: string; + } + + var x: Foo.bar = ""; +} + +namespace Test4 { + export type Foo = { bar: number } + | { bar: string } + + var x: Foo.bar = ""; +} + +namespace Test5 { + export type Foo = { bar: number } + | { wat: string } + + var x: Foo.bar = ""; +} + +//// [errorForUsingPropertyOfTypeAsType01.js] +var Test1; +(function (Test1) { + var x = ""; +})(Test1 || (Test1 = {})); +var Test2; +(function (Test2) { + var Foo = (function () { + function Foo() { + } + return Foo; + }()); + Test2.Foo = Foo; + var x = ""; +})(Test2 || (Test2 = {})); +var Test3; +(function (Test3) { + var x = ""; +})(Test3 || (Test3 = {})); +var Test4; +(function (Test4) { + var x = ""; +})(Test4 || (Test4 = {})); +var Test5; +(function (Test5) { + var x = ""; +})(Test5 || (Test5 = {}));