mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
UMD support
This commit is contained in:
60
tests/baselines/reference/umd-errors.errors.txt
Normal file
60
tests/baselines/reference/umd-errors.errors.txt
Normal file
@@ -0,0 +1,60 @@
|
||||
tests/cases/conformance/externalModules/err1.d.ts(3,1): error TS1314: Global module exports may only appear in module files.
|
||||
tests/cases/conformance/externalModules/err2.d.ts(3,2): error TS1314: Global module exports may only appear in module files.
|
||||
tests/cases/conformance/externalModules/err2.d.ts(3,2): error TS1316: Global module exports may only appear at top level.
|
||||
tests/cases/conformance/externalModules/err3.d.ts(3,1): error TS1184: Modifiers cannot appear here.
|
||||
tests/cases/conformance/externalModules/err3.d.ts(4,1): error TS1184: Modifiers cannot appear here.
|
||||
tests/cases/conformance/externalModules/err3.d.ts(5,1): error TS1184: Modifiers cannot appear here.
|
||||
tests/cases/conformance/externalModules/err3.d.ts(6,7): error TS1134: Variable declaration expected.
|
||||
tests/cases/conformance/externalModules/err4.d.ts(3,2): error TS1316: Global module exports may only appear at top level.
|
||||
tests/cases/conformance/externalModules/err5.ts(3,1): error TS1315: Global module exports may only appear in declaration files.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/err1.d.ts (1 errors) ====
|
||||
|
||||
// Illegal, can't be in script file
|
||||
export as namespace Foo;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1314: Global module exports may only appear in module files.
|
||||
|
||||
==== tests/cases/conformance/externalModules/err2.d.ts (2 errors) ====
|
||||
// Illegal, can't be in external ambient module
|
||||
declare module "Foo" {
|
||||
export as namespace Bar;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1314: Global module exports may only appear in module files.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1316: Global module exports may only appear at top level.
|
||||
}
|
||||
|
||||
==== tests/cases/conformance/externalModules/err3.d.ts (4 errors) ====
|
||||
// Illegal, can't have modifiers
|
||||
export var p;
|
||||
static export as namespace oo1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1184: Modifiers cannot appear here.
|
||||
declare export as namespace oo2;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1184: Modifiers cannot appear here.
|
||||
public export as namespace oo3;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1184: Modifiers cannot appear here.
|
||||
const export as namespace oo4;
|
||||
~~~~~~
|
||||
!!! error TS1134: Variable declaration expected.
|
||||
|
||||
==== tests/cases/conformance/externalModules/err4.d.ts (1 errors) ====
|
||||
// Illegal, must be at top-level
|
||||
export namespace B {
|
||||
export as namespace C1;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1316: Global module exports may only appear at top level.
|
||||
}
|
||||
|
||||
==== tests/cases/conformance/externalModules/err5.ts (1 errors) ====
|
||||
// Illegal, may not appear in implementation files
|
||||
export var v;
|
||||
export as namespace C2;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1315: Global module exports may only appear in declaration files.
|
||||
|
||||
|
||||
36
tests/baselines/reference/umd-errors.js
Normal file
36
tests/baselines/reference/umd-errors.js
Normal file
@@ -0,0 +1,36 @@
|
||||
//// [tests/cases/conformance/externalModules/umd-errors.ts] ////
|
||||
|
||||
//// [err1.d.ts]
|
||||
|
||||
// Illegal, can't be in script file
|
||||
export as namespace Foo;
|
||||
|
||||
//// [err2.d.ts]
|
||||
// Illegal, can't be in external ambient module
|
||||
declare module "Foo" {
|
||||
export as namespace Bar;
|
||||
}
|
||||
|
||||
//// [err3.d.ts]
|
||||
// Illegal, can't have modifiers
|
||||
export var p;
|
||||
static export as namespace oo1;
|
||||
declare export as namespace oo2;
|
||||
public export as namespace oo3;
|
||||
const export as namespace oo4;
|
||||
|
||||
//// [err4.d.ts]
|
||||
// Illegal, must be at top-level
|
||||
export namespace B {
|
||||
export as namespace C1;
|
||||
}
|
||||
|
||||
//// [err5.ts]
|
||||
// Illegal, may not appear in implementation files
|
||||
export var v;
|
||||
export as namespace C2;
|
||||
|
||||
|
||||
|
||||
//// [err5.js]
|
||||
"use strict";
|
||||
8
tests/baselines/reference/umd-errors.symbols
Normal file
8
tests/baselines/reference/umd-errors.symbols
Normal file
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/externalModules/err5.d.ts ===
|
||||
// Illegal, may not appear in implementation files
|
||||
export var v;
|
||||
>v : Symbol(v, Decl(err5.d.ts, 1, 10))
|
||||
|
||||
export as namespace C;
|
||||
|
||||
|
||||
9
tests/baselines/reference/umd-errors.types
Normal file
9
tests/baselines/reference/umd-errors.types
Normal file
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/conformance/externalModules/err5.d.ts ===
|
||||
// Illegal, may not appear in implementation files
|
||||
export var v;
|
||||
>v : any
|
||||
|
||||
export as namespace C;
|
||||
>C : any
|
||||
|
||||
|
||||
21
tests/baselines/reference/umd1.js
Normal file
21
tests/baselines/reference/umd1.js
Normal file
@@ -0,0 +1,21 @@
|
||||
//// [tests/cases/conformance/externalModules/umd1.ts] ////
|
||||
|
||||
//// [foo.d.ts]
|
||||
|
||||
export var x: number;
|
||||
export function fn(): void;
|
||||
export interface Thing { n: typeof x }
|
||||
export as namespace Foo;
|
||||
|
||||
//// [a.ts]
|
||||
/// <reference path="foo.d.ts" />
|
||||
Foo.fn();
|
||||
let x: Foo.Thing;
|
||||
let y: number = x.n;
|
||||
|
||||
|
||||
//// [a.js]
|
||||
/// <reference path="foo.d.ts" />
|
||||
exports.Foo.fn();
|
||||
var x;
|
||||
var y = x.n;
|
||||
33
tests/baselines/reference/umd1.symbols
Normal file
33
tests/baselines/reference/umd1.symbols
Normal file
@@ -0,0 +1,33 @@
|
||||
=== tests/cases/conformance/externalModules/a.ts ===
|
||||
/// <reference path="foo.d.ts" />
|
||||
Foo.fn();
|
||||
>Foo.fn : Symbol(Foo.fn, Decl(foo.d.ts, 1, 21))
|
||||
>Foo : Symbol(Foo, Decl(foo.d.ts, 3, 38))
|
||||
>fn : Symbol(Foo.fn, Decl(foo.d.ts, 1, 21))
|
||||
|
||||
let x: Foo.Thing;
|
||||
>x : Symbol(x, Decl(a.ts, 2, 3))
|
||||
>Foo : Symbol(Foo, Decl(foo.d.ts, 3, 38))
|
||||
>Thing : Symbol(Foo.Thing, Decl(foo.d.ts, 2, 27))
|
||||
|
||||
let y: number = x.n;
|
||||
>y : Symbol(y, Decl(a.ts, 3, 3))
|
||||
>x.n : Symbol(Foo.Thing.n, Decl(foo.d.ts, 3, 24))
|
||||
>x : Symbol(x, Decl(a.ts, 2, 3))
|
||||
>n : Symbol(Foo.Thing.n, Decl(foo.d.ts, 3, 24))
|
||||
|
||||
=== tests/cases/conformance/externalModules/foo.d.ts ===
|
||||
|
||||
export var x: number;
|
||||
>x : Symbol(x, Decl(foo.d.ts, 1, 10))
|
||||
|
||||
export function fn(): void;
|
||||
>fn : Symbol(fn, Decl(foo.d.ts, 1, 21))
|
||||
|
||||
export interface Thing { n: typeof x }
|
||||
>Thing : Symbol(Thing, Decl(foo.d.ts, 2, 27))
|
||||
>n : Symbol(n, Decl(foo.d.ts, 3, 24))
|
||||
>x : Symbol(x, Decl(foo.d.ts, 1, 10))
|
||||
|
||||
export as namespace Foo;
|
||||
|
||||
35
tests/baselines/reference/umd1.types
Normal file
35
tests/baselines/reference/umd1.types
Normal file
@@ -0,0 +1,35 @@
|
||||
=== tests/cases/conformance/externalModules/a.ts ===
|
||||
/// <reference path="foo.d.ts" />
|
||||
Foo.fn();
|
||||
>Foo.fn() : void
|
||||
>Foo.fn : () => void
|
||||
>Foo : typeof Foo
|
||||
>fn : () => void
|
||||
|
||||
let x: Foo.Thing;
|
||||
>x : Foo.Thing
|
||||
>Foo : any
|
||||
>Thing : Foo.Thing
|
||||
|
||||
let y: number = x.n;
|
||||
>y : number
|
||||
>x.n : number
|
||||
>x : Foo.Thing
|
||||
>n : number
|
||||
|
||||
=== tests/cases/conformance/externalModules/foo.d.ts ===
|
||||
|
||||
export var x: number;
|
||||
>x : number
|
||||
|
||||
export function fn(): void;
|
||||
>fn : () => void
|
||||
|
||||
export interface Thing { n: typeof x }
|
||||
>Thing : Thing
|
||||
>n : number
|
||||
>x : number
|
||||
|
||||
export as namespace Foo;
|
||||
>Foo : any
|
||||
|
||||
19
tests/baselines/reference/umd2.errors.txt
Normal file
19
tests/baselines/reference/umd2.errors.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
tests/cases/conformance/externalModules/a.ts(1,1): error TS2304: Cannot find name 'Foo'.
|
||||
tests/cases/conformance/externalModules/a.ts(2,8): error TS2503: Cannot find namespace 'Foo'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/a.ts (2 errors) ====
|
||||
Foo.fn();
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'Foo'.
|
||||
let x: Foo.Thing;
|
||||
~~~
|
||||
!!! error TS2503: Cannot find namespace 'Foo'.
|
||||
let y: number = x.n;
|
||||
|
||||
==== tests/cases/conformance/externalModules/foo.d.ts (0 errors) ====
|
||||
|
||||
export var x: number;
|
||||
export function fn(): void;
|
||||
export as namespace Foo;
|
||||
|
||||
18
tests/baselines/reference/umd2.js
Normal file
18
tests/baselines/reference/umd2.js
Normal file
@@ -0,0 +1,18 @@
|
||||
//// [tests/cases/conformance/externalModules/umd2.ts] ////
|
||||
|
||||
//// [foo.d.ts]
|
||||
|
||||
export var x: number;
|
||||
export function fn(): void;
|
||||
export as namespace Foo;
|
||||
|
||||
//// [a.ts]
|
||||
Foo.fn();
|
||||
let x: Foo.Thing;
|
||||
let y: number = x.n;
|
||||
|
||||
|
||||
//// [a.js]
|
||||
Foo.fn();
|
||||
var x;
|
||||
var y = x.n;
|
||||
22
tests/baselines/reference/umd3.js
Normal file
22
tests/baselines/reference/umd3.js
Normal file
@@ -0,0 +1,22 @@
|
||||
//// [tests/cases/conformance/externalModules/umd3.ts] ////
|
||||
|
||||
//// [foo.d.ts]
|
||||
|
||||
export var x: number;
|
||||
export function fn(): void;
|
||||
export interface Thing { n: typeof x }
|
||||
export as namespace Foo;
|
||||
|
||||
//// [a.ts]
|
||||
import * as Foo from './foo';
|
||||
Foo.fn();
|
||||
let x: Foo.Thing;
|
||||
let y: number = x.n;
|
||||
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
var Foo = require('./foo');
|
||||
Foo.fn();
|
||||
var x;
|
||||
var y = x.n;
|
||||
35
tests/baselines/reference/umd3.symbols
Normal file
35
tests/baselines/reference/umd3.symbols
Normal file
@@ -0,0 +1,35 @@
|
||||
=== tests/cases/conformance/externalModules/a.ts ===
|
||||
import * as Foo from './foo';
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 6))
|
||||
|
||||
Foo.fn();
|
||||
>Foo.fn : Symbol(Foo.fn, Decl(foo.d.ts, 1, 21))
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 6))
|
||||
>fn : Symbol(Foo.fn, Decl(foo.d.ts, 1, 21))
|
||||
|
||||
let x: Foo.Thing;
|
||||
>x : Symbol(x, Decl(a.ts, 2, 3))
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 6))
|
||||
>Thing : Symbol(Foo.Thing, Decl(foo.d.ts, 2, 27))
|
||||
|
||||
let y: number = x.n;
|
||||
>y : Symbol(y, Decl(a.ts, 3, 3))
|
||||
>x.n : Symbol(Foo.Thing.n, Decl(foo.d.ts, 3, 24))
|
||||
>x : Symbol(x, Decl(a.ts, 2, 3))
|
||||
>n : Symbol(Foo.Thing.n, Decl(foo.d.ts, 3, 24))
|
||||
|
||||
=== tests/cases/conformance/externalModules/foo.d.ts ===
|
||||
|
||||
export var x: number;
|
||||
>x : Symbol(x, Decl(foo.d.ts, 1, 10))
|
||||
|
||||
export function fn(): void;
|
||||
>fn : Symbol(fn, Decl(foo.d.ts, 1, 21))
|
||||
|
||||
export interface Thing { n: typeof x }
|
||||
>Thing : Symbol(Thing, Decl(foo.d.ts, 2, 27))
|
||||
>n : Symbol(n, Decl(foo.d.ts, 3, 24))
|
||||
>x : Symbol(x, Decl(foo.d.ts, 1, 10))
|
||||
|
||||
export as namespace Foo;
|
||||
|
||||
37
tests/baselines/reference/umd3.types
Normal file
37
tests/baselines/reference/umd3.types
Normal file
@@ -0,0 +1,37 @@
|
||||
=== tests/cases/conformance/externalModules/a.ts ===
|
||||
import * as Foo from './foo';
|
||||
>Foo : typeof Foo
|
||||
|
||||
Foo.fn();
|
||||
>Foo.fn() : void
|
||||
>Foo.fn : () => void
|
||||
>Foo : typeof Foo
|
||||
>fn : () => void
|
||||
|
||||
let x: Foo.Thing;
|
||||
>x : Foo.Thing
|
||||
>Foo : any
|
||||
>Thing : Foo.Thing
|
||||
|
||||
let y: number = x.n;
|
||||
>y : number
|
||||
>x.n : number
|
||||
>x : Foo.Thing
|
||||
>n : number
|
||||
|
||||
=== tests/cases/conformance/externalModules/foo.d.ts ===
|
||||
|
||||
export var x: number;
|
||||
>x : number
|
||||
|
||||
export function fn(): void;
|
||||
>fn : () => void
|
||||
|
||||
export interface Thing { n: typeof x }
|
||||
>Thing : Thing
|
||||
>n : number
|
||||
>x : number
|
||||
|
||||
export as namespace Foo;
|
||||
>Foo : any
|
||||
|
||||
22
tests/baselines/reference/umd4.js
Normal file
22
tests/baselines/reference/umd4.js
Normal file
@@ -0,0 +1,22 @@
|
||||
//// [tests/cases/conformance/externalModules/umd4.ts] ////
|
||||
|
||||
//// [foo.d.ts]
|
||||
|
||||
export var x: number;
|
||||
export function fn(): void;
|
||||
export interface Thing { n: typeof x }
|
||||
export as namespace Foo;
|
||||
|
||||
//// [a.ts]
|
||||
import * as Bar from './foo';
|
||||
Bar.fn();
|
||||
let x: Bar.Thing;
|
||||
let y: number = x.n;
|
||||
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
var Bar = require('./foo');
|
||||
Bar.fn();
|
||||
var x;
|
||||
var y = x.n;
|
||||
35
tests/baselines/reference/umd4.symbols
Normal file
35
tests/baselines/reference/umd4.symbols
Normal file
@@ -0,0 +1,35 @@
|
||||
=== tests/cases/conformance/externalModules/a.ts ===
|
||||
import * as Bar from './foo';
|
||||
>Bar : Symbol(Bar, Decl(a.ts, 0, 6))
|
||||
|
||||
Bar.fn();
|
||||
>Bar.fn : Symbol(Bar.fn, Decl(foo.d.ts, 1, 21))
|
||||
>Bar : Symbol(Bar, Decl(a.ts, 0, 6))
|
||||
>fn : Symbol(Bar.fn, Decl(foo.d.ts, 1, 21))
|
||||
|
||||
let x: Bar.Thing;
|
||||
>x : Symbol(x, Decl(a.ts, 2, 3))
|
||||
>Bar : Symbol(Bar, Decl(a.ts, 0, 6))
|
||||
>Thing : Symbol(Bar.Thing, Decl(foo.d.ts, 2, 27))
|
||||
|
||||
let y: number = x.n;
|
||||
>y : Symbol(y, Decl(a.ts, 3, 3))
|
||||
>x.n : Symbol(Bar.Thing.n, Decl(foo.d.ts, 3, 24))
|
||||
>x : Symbol(x, Decl(a.ts, 2, 3))
|
||||
>n : Symbol(Bar.Thing.n, Decl(foo.d.ts, 3, 24))
|
||||
|
||||
=== tests/cases/conformance/externalModules/foo.d.ts ===
|
||||
|
||||
export var x: number;
|
||||
>x : Symbol(x, Decl(foo.d.ts, 1, 10))
|
||||
|
||||
export function fn(): void;
|
||||
>fn : Symbol(fn, Decl(foo.d.ts, 1, 21))
|
||||
|
||||
export interface Thing { n: typeof x }
|
||||
>Thing : Symbol(Thing, Decl(foo.d.ts, 2, 27))
|
||||
>n : Symbol(n, Decl(foo.d.ts, 3, 24))
|
||||
>x : Symbol(x, Decl(foo.d.ts, 1, 10))
|
||||
|
||||
export as namespace Foo;
|
||||
|
||||
37
tests/baselines/reference/umd4.types
Normal file
37
tests/baselines/reference/umd4.types
Normal file
@@ -0,0 +1,37 @@
|
||||
=== tests/cases/conformance/externalModules/a.ts ===
|
||||
import * as Bar from './foo';
|
||||
>Bar : typeof Bar
|
||||
|
||||
Bar.fn();
|
||||
>Bar.fn() : void
|
||||
>Bar.fn : () => void
|
||||
>Bar : typeof Bar
|
||||
>fn : () => void
|
||||
|
||||
let x: Bar.Thing;
|
||||
>x : Bar.Thing
|
||||
>Bar : any
|
||||
>Thing : Bar.Thing
|
||||
|
||||
let y: number = x.n;
|
||||
>y : number
|
||||
>x.n : number
|
||||
>x : Bar.Thing
|
||||
>n : number
|
||||
|
||||
=== tests/cases/conformance/externalModules/foo.d.ts ===
|
||||
|
||||
export var x: number;
|
||||
>x : number
|
||||
|
||||
export function fn(): void;
|
||||
>fn : () => void
|
||||
|
||||
export interface Thing { n: typeof x }
|
||||
>Thing : Thing
|
||||
>n : number
|
||||
>x : number
|
||||
|
||||
export as namespace Foo;
|
||||
>Foo : any
|
||||
|
||||
20
tests/baselines/reference/umd5.errors.txt
Normal file
20
tests/baselines/reference/umd5.errors.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
tests/cases/conformance/externalModules/a.ts(6,9): error TS2304: Cannot find name 'Foo'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/a.ts (1 errors) ====
|
||||
import * as Bar from './foo';
|
||||
Bar.fn();
|
||||
let x: Bar.Thing;
|
||||
let y: number = x.n;
|
||||
// should error
|
||||
let z = Foo;
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'Foo'.
|
||||
|
||||
==== tests/cases/conformance/externalModules/foo.d.ts (0 errors) ====
|
||||
|
||||
export var x: number;
|
||||
export function fn(): void;
|
||||
export interface Thing { n: typeof x }
|
||||
export as namespace Foo;
|
||||
|
||||
26
tests/baselines/reference/umd5.js
Normal file
26
tests/baselines/reference/umd5.js
Normal file
@@ -0,0 +1,26 @@
|
||||
//// [tests/cases/conformance/externalModules/umd5.ts] ////
|
||||
|
||||
//// [foo.d.ts]
|
||||
|
||||
export var x: number;
|
||||
export function fn(): void;
|
||||
export interface Thing { n: typeof x }
|
||||
export as namespace Foo;
|
||||
|
||||
//// [a.ts]
|
||||
import * as Bar from './foo';
|
||||
Bar.fn();
|
||||
let x: Bar.Thing;
|
||||
let y: number = x.n;
|
||||
// should error
|
||||
let z = Foo;
|
||||
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
var Bar = require('./foo');
|
||||
Bar.fn();
|
||||
var x;
|
||||
var y = x.n;
|
||||
// should error
|
||||
var z = Foo;
|
||||
31
tests/cases/conformance/externalModules/umd-errors.ts
Normal file
31
tests/cases/conformance/externalModules/umd-errors.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
// @module: commonjs
|
||||
|
||||
// @filename: err1.d.ts
|
||||
// Illegal, can't be in script file
|
||||
export as namespace Foo;
|
||||
|
||||
// @filename: err2.d.ts
|
||||
// Illegal, can't be in external ambient module
|
||||
declare module "Foo" {
|
||||
export as namespace Bar;
|
||||
}
|
||||
|
||||
// @filename: err3.d.ts
|
||||
// Illegal, can't have modifiers
|
||||
export var p;
|
||||
static export as namespace oo1;
|
||||
declare export as namespace oo2;
|
||||
public export as namespace oo3;
|
||||
const export as namespace oo4;
|
||||
|
||||
// @filename: err4.d.ts
|
||||
// Illegal, must be at top-level
|
||||
export namespace B {
|
||||
export as namespace C1;
|
||||
}
|
||||
|
||||
// @filename: err5.ts
|
||||
// Illegal, may not appear in implementation files
|
||||
export var v;
|
||||
export as namespace C2;
|
||||
|
||||
14
tests/cases/conformance/externalModules/umd1.ts
Normal file
14
tests/cases/conformance/externalModules/umd1.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
// @module: commonjs
|
||||
// @noImplicitReferences: true
|
||||
|
||||
// @filename: foo.d.ts
|
||||
export var x: number;
|
||||
export function fn(): void;
|
||||
export interface Thing { n: typeof x }
|
||||
export as namespace Foo;
|
||||
|
||||
// @filename: a.ts
|
||||
/// <reference path="foo.d.ts" />
|
||||
Foo.fn();
|
||||
let x: Foo.Thing;
|
||||
let y: number = x.n;
|
||||
12
tests/cases/conformance/externalModules/umd2.ts
Normal file
12
tests/cases/conformance/externalModules/umd2.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// @module: commonjs
|
||||
// @noImplicitReferences: true
|
||||
|
||||
// @filename: foo.d.ts
|
||||
export var x: number;
|
||||
export function fn(): void;
|
||||
export as namespace Foo;
|
||||
|
||||
// @filename: a.ts
|
||||
Foo.fn();
|
||||
let x: Foo.Thing;
|
||||
let y: number = x.n;
|
||||
14
tests/cases/conformance/externalModules/umd3.ts
Normal file
14
tests/cases/conformance/externalModules/umd3.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
// @module: commonjs
|
||||
// @noImplicitReferences: true
|
||||
|
||||
// @filename: foo.d.ts
|
||||
export var x: number;
|
||||
export function fn(): void;
|
||||
export interface Thing { n: typeof x }
|
||||
export as namespace Foo;
|
||||
|
||||
// @filename: a.ts
|
||||
import * as Foo from './foo';
|
||||
Foo.fn();
|
||||
let x: Foo.Thing;
|
||||
let y: number = x.n;
|
||||
14
tests/cases/conformance/externalModules/umd4.ts
Normal file
14
tests/cases/conformance/externalModules/umd4.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
// @module: commonjs
|
||||
// @noImplicitReferences: true
|
||||
|
||||
// @filename: foo.d.ts
|
||||
export var x: number;
|
||||
export function fn(): void;
|
||||
export interface Thing { n: typeof x }
|
||||
export as namespace Foo;
|
||||
|
||||
// @filename: a.ts
|
||||
import * as Bar from './foo';
|
||||
Bar.fn();
|
||||
let x: Bar.Thing;
|
||||
let y: number = x.n;
|
||||
16
tests/cases/conformance/externalModules/umd5.ts
Normal file
16
tests/cases/conformance/externalModules/umd5.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
// @module: commonjs
|
||||
// @noImplicitReferences: true
|
||||
|
||||
// @filename: foo.d.ts
|
||||
export var x: number;
|
||||
export function fn(): void;
|
||||
export interface Thing { n: typeof x }
|
||||
export as namespace Foo;
|
||||
|
||||
// @filename: a.ts
|
||||
import * as Bar from './foo';
|
||||
Bar.fn();
|
||||
let x: Bar.Thing;
|
||||
let y: number = x.n;
|
||||
// should error
|
||||
let z = Foo;
|
||||
Reference in New Issue
Block a user