Merge branch 'master' into isInMultiLineComment

This commit is contained in:
Arthur Ozga
2017-08-04 14:26:24 -07:00
1154 changed files with 257792 additions and 221227 deletions
@@ -0,0 +1 @@
var x: any[[]];
@@ -0,0 +1,20 @@
// @checkJs: true
// @allowJs: true
// @Filename: main.js
// @noemit: true
function allRest() { arguments; }
allRest();
allRest(1, 2, 3);
function someRest(x, y) { arguments; }
someRest(); // x and y are still optional because they are in a JS file
someRest(1, 2, 3);
/**
* @param {number} x - a thing
*/
function jsdocced(x) { arguments; }
jsdocced(1);
function dontDoubleRest(x, ...y) { arguments; }
dontDoubleRest(1, 2, 3);
@@ -0,0 +1,23 @@
function awaitString() {
await 'literal';
}
function awaitNumber() {
await 1;
}
function awaitTrue() {
await true;
}
function awaitFalse() {
await false;
}
function awaitNull() {
await null;
}
function awaitUndefined() {
await undefined;
}
@@ -0,0 +1,27 @@
// @lib: dom, es7
interface A {
id: string
}
interface B {
id: string
fieldB: string
}
async function countEverything(): Promise<number> {
const providerA = async (): Promise<A[]> => { return [] }
const providerB = async (): Promise<B[]> => { return [] }
const [resultA, resultB] = await Promise.all([
providerA(),
providerB(),
]);
const dataA: A[] = resultA;
const dataB: B[] = resultB;
if (dataA && dataB) {
return dataA.length + dataB.length;
}
return 0;
}
@@ -0,0 +1,6 @@
// @declaration: true
function doSomethingWithKeys<T>(...keys: (keyof T)[]) { }
const utilityFunctions = {
doSomethingWithKeys
};
@@ -0,0 +1,6 @@
// @strictNullChecks: true
// @declaration: true
export class Foo {
constructor(public bar?: string) {
}
}
@@ -0,0 +1,36 @@
// @strictNullChecks: true
type foo = {
bar: number | null;
baz: string;
nested: {
a: number;
b: string | null;
}
};
const aFoo: foo = { bar: 3, baz: "b", nested: { a: 1, b: "y" } };
if (aFoo.bar && aFoo.nested.b) {
const { bar, baz, nested: {a, b: text} } = aFoo;
const right: number = aFoo.bar;
const wrong: number = bar;
const another: string = baz;
const aAgain: number = a;
const bAgain: string = text;
}
type bar = {
elem1: number | null;
elem2: foo | null;
};
const bBar = { elem1: 7, elem2: aFoo };
if (bBar.elem2 && bBar.elem2.bar && bBar.elem2.nested.b) {
const { bar, baz, nested: {a, b: text} } = bBar.elem2;
const right: number = bBar.elem2.bar;
const wrong: number = bar;
const another: string = baz;
const aAgain: number = a;
const bAgain: string = text;
}
@@ -0,0 +1,19 @@
enum Foo {
"__a" = 1,
"(Anonymous function)" = 2,
"(Anonymous class)" = 4,
"__call" = 10
}
namespace Foo {
export function ___call(): number {
return 5;
}
}
function Bar() {
return "no";
}
namespace Bar {
export function __call(x: number): number {
return 5;
}
}
@@ -0,0 +1,11 @@
// @module: commonjs
// @filename: index.tsx
export * from "./b";
export * from "./c";
// @filename: b.ts
export function __foo(): number | void {}
// @filename: c.ts
export function __foo(): string | void {}
@@ -0,0 +1,13 @@
function doThing() {
__call: while (true) {
aLabel: for (let i = 0; i < 10; i++) {
if (i === 3) {
break __call;
}
if (i === 5) {
break aLabel;
}
}
}
}
doThing();
@@ -0,0 +1,23 @@
interface Properties {
property1: string;
__property2: string;
}
// As expected, I can make an object satisfying this interface
const ok: Properties = {
property1: "",
__property2: ""
};
// As expected, "__property2" is indeed a key of the type
type Keys = keyof Properties;
const k: Keys = "__property2"; // ok
// This should be valid
type Property2Type = Properties["__property2"];
// And should work with partial
const partial: Partial<Properties> = {
property1: "",
__property2: ""
};
@@ -0,0 +1,18 @@
// @jsx: react
// @jsxFactory: __make
// @module: commonjs
// @filename: index.tsx
declare global {
namespace JSX {
interface IntrinsicElements {
__foot: any;
}
}
function __make (params: object): any;
}
const thing = <__foot></__foot>;
export {}
@@ -0,0 +1,44 @@
namespace Test1 {
export interface Foo {
bar: string;
}
var x: Foo.bar = "";
var y: Test1.Foo.bar = "";
}
namespace Test2 {
export class Foo {
bar: string;
}
var x: Foo.bar = "";
var y: Test2.Foo.bar = "";
}
namespace Test3 {
export type Foo = {
bar: string;
}
var x: Foo.bar = "";
var y: Test3.Foo.bar = "";
}
namespace Test4 {
export type Foo = { bar: number }
| { bar: string }
var x: Foo.bar = "";
var y: Test4.Foo.bar = "";
}
namespace Test5 {
export type Foo = { bar: number }
| { wat: string }
var x: Foo.bar = "";
var y: Test5.Foo.bar = "";
}
import lol = Test5.Foo.
@@ -0,0 +1,16 @@
declare function f({ a: number }): void
interface I {
readonly n: number;
}
declare let i: I;
f({ a: 1, ...i });
interface R {
opt?: number
}
interface L {
opt: string
}
declare let l: L;
declare let r: R;
f({ a: 1, ...l, ...r });
@@ -0,0 +1,7 @@
namespace ns_class {
export default class {}
}
namespace ns_abstract_class {
export default abstract class {}
}
@@ -0,0 +1,7 @@
namespace ns_function {
export default function () {}
}
namespace ns_async_function {
export default async function () {}
}
@@ -0,0 +1,35 @@
enum Kind {
A,
B,
}
interface Base {
kind: Kind;
}
interface A extends Base {
kind: Kind.A;
yar: any;
}
interface B extends Base {
kind: Kind.B;
gar: any;
}
type Both = A | B;
function isBoth(x: Base): x is Both {
return true;
}
let foo: Base = undefined;
if (isBoth(foo)) {
switch (foo.kind) {
case Kind.A:
const myA: A = foo; // Should not be an error
break;
case Kind.B:
const myB: B = foo;
break;
}
}
+10 -1
View File
@@ -458,6 +458,15 @@ const Derived02c01 = new Derived02(1);
const Derived02c02 = new Derived02<number>();
const Derived02c03 = new Derived02<number>(1);
// https://github.com/Microsoft/TypeScript/issues/16211
interface Base02 {}
interface Base02Constructor { new <T = A>(a: T): Base02 & T; }
declare const Base02: Base02Constructor;
declare class Derived03 extends Base02 {}
const Derived03c00 = new Derived03(ab);
const Derived03c01 = Derived03c00.a;
type DerivedProps = keyof Derived03;
type t00<T = number> = { a: T; }
const t00c00 = (<t00>x).a;
const t00c01 = (<t00<number>>x).a;
@@ -478,4 +487,4 @@ const t03c00 = (<t03<number>>x).a;
const t03c01 = (<t03<1>>x).a;
const t03c02 = (<t03<number, number>>x).a;
const t03c03 = (<t03<1, 1>>x).a;
const t03c04 = (<t03<number, 1>>x).a;
const t03c04 = (<t03<number, 1>>x).a;
+4
View File
@@ -6,12 +6,16 @@ export class A { }
// @filename: b.ts
import { A } from "./a";
export * from "./a";
export class B extends A { }
// @filename: tslib.d.ts
export declare function __extends(d: Function, b: Function): void;
export declare function __assign(t: any, ...sources: any[]): any;
export declare function __rest(t: any, propertyNames: string[]): any;
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
export declare function __param(paramIndex: number, decorator: Function): Function;
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
export declare function __generator(thisArg: any, body: Function): any;
export declare function __exportStar(m: any, exports: any): void;
@@ -49,7 +49,10 @@ declare namespace N {
// @filename: tslib.d.ts
export declare function __extends(d: Function, b: Function): void;
export declare function __assign(t: any, ...sources: any[]): any;
export declare function __rest(t: any, propertyNames: string[]): any;
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
export declare function __param(paramIndex: number, decorator: Function): Function;
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
export declare function __generator(thisArg: any, body: Function): any;
export declare function __exportStar(m: any, exports: any): void;
@@ -5,6 +5,7 @@
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @filename: external.ts
export * from "./other";
export class A { }
export class B extends A { }
@@ -20,6 +21,9 @@ const o = { a: 1 };
const y = { ...o };
const { ...x } = y;
// @filename: other.ts
export const x = 1;
// @filename: script.ts
class A { }
class B extends A { }
@@ -6,6 +6,7 @@ export class A { }
// @filename: b.ts
import { A } from "./a";
export * from "./a";
export class B extends A { }
// @filename: tslib.d.ts
@@ -0,0 +1,14 @@
// @strict: true
interface Dictionary<T> {
[myFavouriteType: string]: T | undefined
}
const x = 'bar'
let foo: Dictionary<number> = {}
if (foo[x] === undefined) {
foo[x] = 1
}
else {
let nu = foo[x]
let n = foo[x]
foo[x]!++
}
@@ -10,6 +10,16 @@ export class C {}
declare type T = number;
export = T;
// @Filename: /node_modules/foo/bar.d.ts
export type T = number;
// @Filename: /node_modules/foo/index.d.ts
export { T } from "./bar"; // In a declaration file, so not an error.
// @Filename: /node_modules/baz/index.d.ts
declare module "baz" {
export { T } from "foo"; // Also allowed.
}
// @Filename: /user.ts
// Error, can't re-export something that's only a type.
@@ -0,0 +1,4 @@
// @allowJs: true
// @filename: /src/a.js
// @out: /bin/a.js
0!
@@ -1,3 +1,5 @@
// @allowJs: true
// @filename: a.js
var v = <string>undefined;
// @filename: /src/a.js
// @out: /lib/a.js
0 as number;
var v = <string>undefined;
@@ -0,0 +1,12 @@
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @noImplicitThis: true
// @Filename: /a.js
const o = {
a() {
// Should not be treated as a declaration. Should be an error.
this.a = 0;
}
};
@@ -0,0 +1,12 @@
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @noImplicitThis: true
// @Filename: /a.js
const o = {
a() {
// Should not be treated as a declaration.
this.a = () => {};
}
};
@@ -0,0 +1,8 @@
// @Filename: foo.js
// @noEmit: true
// @allowJs: true
// Test #16139
function Foo() {
arguments;
return new Foo();
}
+19 -1
View File
@@ -27,4 +27,22 @@ f(1); f(true).length;
// @type has no effect either.
/** @type {{ x?: number }} */
const z = {};
z.x = 1;
z.x = 1; // Error
// @template tag should not interfere with constraint or default.
/** @template T */
interface I<T extends number = 0> {}
/** @template T */
function tem<T extends number>(t: T): I<T> { return {}; }
let i: I; // Should succeed thanks to type parameter default
/** @typedef {string} N.Str */
import M = N; // Error: @typedef does not create namespaces in TypeScript code.
// Not legal JSDoc, but that shouldn't matter in TypeScript.
/**
* @type {{foo: (function(string, string): string)}}
*/
const obj = { foo: (a, b) => a + b };
@@ -0,0 +1,9 @@
// @filename: example.js
// @checkJs: true
// @allowJs: true
// @noEmit: true
// @ts-check
/**
* @type {function(@foo)}
*/
let x;
@@ -0,0 +1,10 @@
// @allowJs: true
// @noEmit: true
// @checkJs: true
// @filename: index.js
/**
* @param {Array<*>} list
*/
function thing(list) {
return list;
}
@@ -0,0 +1,71 @@
// @allowJs: true
// @noEmit: true
// @checkJs: true
// @filename: index.js
/**
* @param {<T>(m: Boolean<T>) => string} somebody
*/
function sayHello(somebody) {
return 'Hello ' + somebody;
}
// @filename: index2.js
/**
* @param {<T>(m: Void<T>) => string} somebody
*/
function sayHello2(somebody) {
return 'Hello ' + somebody;
}
// @filename: index3.js
/**
* @param {<T>(m: Undefined<T>) => string} somebody
*/
function sayHello3(somebody) {
return 'Hello ' + somebody;
}
// @filename: index4.js
/**
* @param {<T>(m: Function<T>) => string} somebody
*/
function sayHello4(somebody) {
return 'Hello ' + somebody;
}
// @filename: index5.js
/**
* @param {<T>(m: String<T>) => string} somebody
*/
function sayHello5(somebody) {
return 'Hello ' + somebody;
}
// @filename: index6.js
/**
* @param {<T>(m: Number<T>) => string} somebody
*/
function sayHello6(somebody) {
return 'Hello ' + somebody;
}
// @filename: index7.js
/**
* @param {<T>(m: Object<T>) => string} somebody
*/
function sayHello7(somebody) {
return 'Hello ' + somebody;
}
// @filename: index8.js
function fn() {}
/**
* @param {fn<T>} somebody
*/
function sayHello8(somebody) { }
@@ -0,0 +1,12 @@
// @jsx: preserve
// @filename: index.tsx
declare namespace JSX {
interface Element { }
interface IntrinsicElements {
div: {
static?: boolean;
};
}
}
export default <div static={true} />;
@@ -0,0 +1,15 @@
// Repro from #16985
interface MyInterface {
something: number;
}
class MyClass<T extends MyInterface> {
doIt(data : Partial<T>) {}
}
class MySubClass extends MyClass<MyInterface> {}
function fn(arg: typeof MyClass) {};
fn(MySubClass);
@@ -0,0 +1,22 @@
// OK -- one is type, one is value
interface b {}
export const b = 1;
// OK -- one is a type, one is a namespace, one is a value.
type t = 0;
namespace t { interface I {} }
export const t = 0;
// Should get errors if they have some meaning in common.
// both types
interface c {}
export interface c {}
// both types (class is also value, but that doesn't matter)
interface d {}
export class d {}
// both namespaces
namespace N { }
export namespace N {}
+24
View File
@@ -0,0 +1,24 @@
// @strictNullChecks: true
// @Filename: /a.d.ts
declare const a0: number | undefined;
export default a0;
export const a1: number | undefined;
// @Filename: /b.d.ts
declare const b: number | undefined;
declare namespace b {}
export = b;
// @Filename: /x.ts
import a0, { a1, a1 as a2 } from "./a";
import * as b0 from "./b";
import b1 = require("./b");
let x: number;
if (a0) x = a0;
if (a1) x = a1;
if (a2) x = a2;
if (b0) x = b0;
if (b1) x = b1;
@@ -0,0 +1,11 @@
// @strictNullChecks: true
// @Filename: /a.d.ts
declare namespace a {
export const x: number;
}
export = a;
// @Filename: /b.ts
import a = require("./a");
a.x;
@@ -0,0 +1,9 @@
// @noStrictGenericChecks: true
type A = <T, U>(x: T, y: U) => [T, U];
type B = <S>(x: S, y: S) => [S, S];
function f(a: A, b: B) {
a = b; // Error disabled here
b = a; // Ok
}
@@ -0,0 +1,2 @@
(a,
new)
@@ -0,0 +1,2 @@
(a,
1)
@@ -0,0 +1,2 @@
(a,
'')
@@ -0,0 +1,13 @@
type F1 = {
(n: number) => string; // should be : not =>
}
type F2 = (n: number): string; // should be => not :
// doesn't work in non-type contexts, where the return type is optional
let f = (n: number) => string => n.toString();
let o = {
m(n: number) => string {
return n.toString();
}
};
@@ -0,0 +1,3 @@
let x: 1 = +1;
let y: -1 = -1;
@@ -0,0 +1,4 @@
// @target: es5
class Promise<T> {}
async function foo() {}
const x = foo();
@@ -0,0 +1,5 @@
// @target: es2017
export async function get(): Promise<[]> {
let emails = [];
return emails;
}
@@ -0,0 +1,6 @@
function recursive() {
let x = <T>(subkey: T) => recursive();
return x as typeof x & { p };
}
let result = recursive()(1)
@@ -0,0 +1,7 @@
// @sourcemap: true
// @downlevelIteration: true
// @noEmitHelpers: true
// @lib: es2015
function * f() {
var x = 1, y;
}
@@ -0,0 +1,9 @@
// @target: es2015
// @module: commonjs
// @lib: es2015,dom
// @filename: main.ts
import { X } from "./other";
const X = 42;
console.log('X is ' + X);
// @filename: other.ts
export type X = {};
@@ -0,0 +1,30 @@
// Repro from #17041
interface Named {
name: string;
}
function parrot<T extends Named>(obj: T): T {
return obj;
}
parrot({
name: "TypeScript",
});
parrot({
name: "TypeScript",
age: 5,
});
parrot({
name: "TypeScript",
age: function () { },
});
parrot({
name: "TypeScript",
sayHello() {
},
});
@@ -0,0 +1,4 @@
enum E {
"__foo" = 1,
bar = E["__foo"] + 1
}
@@ -0,0 +1,5 @@
//@noUnusedLocals:true
//@noUnusedParameters:true
type Alias<T> = { };
type Alias2<T> = { x: T };
+5 -1
View File
@@ -8,10 +8,14 @@ function getDefaultSettings() {
}
function doSomething(settings: Settings) { /* ... */ }
// forgot to call `getDefaultSettings`
// but it is not caught because we don't check for call signatures
doSomething(getDefaultSettings);
// same for arrow expressions:
doSomething(() => { });
doSomething(12);
doSomething('completely wrong');
doSomething(false);
// this is an oddly popular way of defining settings
// this example is from services/textChanges.ts
@@ -0,0 +1,3 @@
function yieldString() {
yield 'literal';
}
@@ -0,0 +1,15 @@
// @target:es5
// @experimentaldecorators: true
declare var dec: any;
class A {}
// https://github.com/Microsoft/TypeScript/issues/16417
@dec
class B extends A {
static x = 1;
static y = B.x;
m() {
return B.x;
}
}
@@ -10,6 +10,8 @@ p1.then(zero => {
return zero.foo();
})
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
@@ -15,6 +15,7 @@ declare var console: any;
class C {
private myModule = import("./0");
method() {
const loadAsync = import ("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
@@ -0,0 +1,31 @@
// @module: amd
// @target: es3
// @lib: es6
// @filename: test.ts
export async function fn() {
const req = await import('./test') // ONE
}
export class cl1 {
public async m() {
const req = await import('./test') // TWO
}
}
export const obj = {
m: async () => {
const req = await import('./test') // THREE
}
}
export class cl2 {
public p = {
m: async () => {
const req = await import('./test') // FOUR
}
}
}
export const l = async () => {
const req = await import('./test') // FIVE
}
@@ -0,0 +1,31 @@
// @module: commonjs
// @target: es3
// @lib: es6
// @filename: test.ts
export async function fn() {
const req = await import('./test') // ONE
}
export class cl1 {
public async m() {
const req = await import('./test') // TWO
}
}
export const obj = {
m: async () => {
const req = await import('./test') // THREE
}
}
export class cl2 {
public p = {
m: async () => {
const req = await import('./test') // FOUR
}
}
}
export const l = async () => {
const req = await import('./test') // FIVE
}
@@ -0,0 +1,31 @@
// @module: system
// @target: es3
// @lib: es6
// @filename: test.ts
export async function fn() {
const req = await import('./test') // ONE
}
export class cl1 {
public async m() {
const req = await import('./test') // TWO
}
}
export const obj = {
m: async () => {
const req = await import('./test') // THREE
}
}
export class cl2 {
public p = {
m: async () => {
const req = await import('./test') // FOUR
}
}
}
export const l = async () => {
const req = await import('./test') // FIVE
}
@@ -0,0 +1,31 @@
// @module: umd
// @target: es3
// @lib: es6
// @filename: test.ts
export async function fn() {
const req = await import('./test') // ONE
}
export class cl1 {
public async m() {
const req = await import('./test') // TWO
}
}
export const obj = {
m: async () => {
const req = await import('./test') // THREE
}
}
export class cl2 {
public p = {
m: async () => {
const req = await import('./test') // FOUR
}
}
}
export const l = async () => {
const req = await import('./test') // FIVE
}
@@ -0,0 +1,31 @@
// @module: amd
// @target: es5
// @lib: es6
// @filename: test.ts
export async function fn() {
const req = await import('./test') // ONE
}
export class cl1 {
public async m() {
const req = await import('./test') // TWO
}
}
export const obj = {
m: async () => {
const req = await import('./test') // THREE
}
}
export class cl2 {
public p = {
m: async () => {
const req = await import('./test') // FOUR
}
}
}
export const l = async () => {
const req = await import('./test') // FIVE
}
@@ -0,0 +1,31 @@
// @module: commonjs
// @target: es5
// @lib: es6
// @filename: test.ts
export async function fn() {
const req = await import('./test') // ONE
}
export class cl1 {
public async m() {
const req = await import('./test') // TWO
}
}
export const obj = {
m: async () => {
const req = await import('./test') // THREE
}
}
export class cl2 {
public p = {
m: async () => {
const req = await import('./test') // FOUR
}
}
}
export const l = async () => {
const req = await import('./test') // FIVE
}
@@ -0,0 +1,31 @@
// @module: system
// @target: es5
// @lib: es6
// @filename: test.ts
export async function fn() {
const req = await import('./test') // ONE
}
export class cl1 {
public async m() {
const req = await import('./test') // TWO
}
}
export const obj = {
m: async () => {
const req = await import('./test') // THREE
}
}
export class cl2 {
public p = {
m: async () => {
const req = await import('./test') // FOUR
}
}
}
export const l = async () => {
const req = await import('./test') // FIVE
}
@@ -0,0 +1,31 @@
// @module: umd
// @target: es5
// @lib: es6
// @filename: test.ts
export async function fn() {
const req = await import('./test') // ONE
}
export class cl1 {
public async m() {
const req = await import('./test') // TWO
}
}
export const obj = {
m: async () => {
const req = await import('./test') // THREE
}
}
export class cl2 {
public p = {
m: async () => {
const req = await import('./test') // FOUR
}
}
}
export const l = async () => {
const req = await import('./test') // FIVE
}
@@ -0,0 +1,30 @@
// @module: amd
// @target: es6
// @filename: test.ts
export async function fn() {
const req = await import('./test') // ONE
}
export class cl1 {
public async m() {
const req = await import('./test') // TWO
}
}
export const obj = {
m: async () => {
const req = await import('./test') // THREE
}
}
export class cl2 {
public p = {
m: async () => {
const req = await import('./test') // FOUR
}
}
}
export const l = async () => {
const req = await import('./test') // FIVE
}
@@ -0,0 +1,30 @@
// @module: commonjs
// @target: es6
// @filename: test.ts
export async function fn() {
const req = await import('./test') // ONE
}
export class cl1 {
public async m() {
const req = await import('./test') // TWO
}
}
export const obj = {
m: async () => {
const req = await import('./test') // THREE
}
}
export class cl2 {
public p = {
m: async () => {
const req = await import('./test') // FOUR
}
}
}
export const l = async () => {
const req = await import('./test') // FIVE
}
@@ -0,0 +1,30 @@
// @module: system
// @target: es6
// @filename: test.ts
export async function fn() {
const req = await import('./test') // ONE
}
export class cl1 {
public async m() {
const req = await import('./test') // TWO
}
}
export const obj = {
m: async () => {
const req = await import('./test') // THREE
}
}
export class cl2 {
public p = {
m: async () => {
const req = await import('./test') // FOUR
}
}
}
export const l = async () => {
const req = await import('./test') // FIVE
}
@@ -0,0 +1,30 @@
// @module: umd
// @target: es6
// @filename: test.ts
export async function fn() {
const req = await import('./test') // ONE
}
export class cl1 {
public async m() {
const req = await import('./test') // TWO
}
}
export const obj = {
m: async () => {
const req = await import('./test') // THREE
}
}
export class cl2 {
public p = {
m: async () => {
const req = await import('./test') // FOUR
}
}
}
export const l = async () => {
const req = await import('./test') // FIVE
}
@@ -0,0 +1,30 @@
// @module: esnext
// @target: esnext
// @filename: test.ts
export async function fn() {
const req = await import('./test') // ONE
}
export class cl1 {
public async m() {
const req = await import('./test') // TWO
}
}
export const obj = {
m: async () => {
const req = await import('./test') // THREE
}
}
export class cl2 {
public p = {
m: async () => {
const req = await import('./test') // FOUR
}
}
}
export const l = async () => {
const req = await import('./test') // FIVE
}
@@ -11,6 +11,20 @@ p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
class C {
method() {
const loadAsync = import ("./0");
}
}
export class D {
method() {
const loadAsync = import ("./0");
}
}
@@ -11,6 +11,20 @@ p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
class C {
method() {
const loadAsync = import ("./0");
}
}
export class D {
method() {
const loadAsync = import ("./0");
}
}
@@ -11,6 +11,20 @@ p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
class C {
method() {
const loadAsync = import ("./0");
}
}
export class D {
method() {
const loadAsync = import ("./0");
}
}
@@ -11,6 +11,20 @@ p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
class C {
method() {
const loadAsync = import ("./0");
}
}
export class D {
method() {
const loadAsync = import ("./0");
}
}
@@ -0,0 +1,29 @@
// @module: amd
// @target: es6
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
class C {
method() {
const loadAsync = import ("./0");
}
}
export class D {
method() {
const loadAsync = import ("./0");
}
}
@@ -0,0 +1,29 @@
// @module: commonjs
// @target: es6
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
class C {
method() {
const loadAsync = import ("./0");
}
}
export class D {
method() {
const loadAsync = import ("./0");
}
}
@@ -0,0 +1,29 @@
// @module: system
// @target: es6
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
class C {
method() {
const loadAsync = import ("./0");
}
}
export class D {
method() {
const loadAsync = import ("./0");
}
}
@@ -0,0 +1,29 @@
// @module: umd
// @target: es6
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import("./0");
var p1 = import("./0");
p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
class C {
method() {
const loadAsync = import ("./0");
}
}
export class D {
method() {
const loadAsync = import ("./0");
}
}
@@ -10,6 +10,8 @@ p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
@@ -15,6 +15,21 @@ declare var console: any;
class C {
private myModule = import("./0");
method() {
const loadAsync = import("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
}
export class D {
private myModule = import("./0");
method() {
const loadAsync = import("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
@@ -10,6 +10,8 @@ p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
@@ -15,6 +15,21 @@ declare var console: any;
class C {
private myModule = import("./0");
method() {
const loadAsync = import ("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
}
export class D {
private myModule = import("./0");
method() {
const loadAsync = import("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
@@ -10,6 +10,8 @@ p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
@@ -15,6 +15,21 @@ declare var console: any;
class C {
private myModule = import("./0");
method() {
const loadAsync = import("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
}
export class D {
private myModule = import("./0");
method() {
const loadAsync = import("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
@@ -10,6 +10,8 @@ p1.then(zero => {
return zero.foo();
});
export var p2 = import("./0");
function foo() {
const p2 = import("./0");
}
@@ -15,6 +15,21 @@ declare var console: any;
class C {
private myModule = import("./0");
method() {
const loadAsync = import("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
}
export class D {
private myModule = import("./0");
method() {
const loadAsync = import("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
@@ -0,0 +1,8 @@
// @module: esnext
// @target: esnext
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
import
import { foo } from './0';
@@ -0,0 +1,7 @@
// @module: esnext
// @target: esnext
// @filename: 0.ts
export function foo() { return "foo"; }
// @filename: 1.ts
var x = import { foo } from './0';
@@ -0,0 +1,25 @@
// @filename: 0.ts
export class B {
print() { return "I am B"}
}
export function foo() { return "foo" }
// @filename: 1.ts
export function backup() { return "backup"; }
// @filename: 2.ts
declare var console: any;
class C {
private myModule = import("./0");
method() {
const loadAsync = import("./0");
this.myModule.then(Zero => {
console.log(Zero.foo());
}, async err => {
console.log(err);
let one = await import("./1");
console.log(one.backup());
});
}
}

Some files were not shown because too many files have changed in this diff Show More