mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-20 19:45:07 -06:00
Create synthetic default exports for dynamic imports (#17492)
* Create synthetic default exports for dynamic imports * Slightly better solution * Actually accept baselines * Slightly adjust synthetic type * Cache synthetic type * Inline variables, remove non-required calls * Rename function
This commit is contained in:
parent
847d7fe3c8
commit
43e758e1a9
@ -1757,7 +1757,7 @@ namespace ts {
|
||||
// An external module with an 'export =' declaration resolves to the target of the 'export =' declaration,
|
||||
// and an external module with no 'export =' declaration resolves to the module itself.
|
||||
function resolveExternalModuleSymbol(moduleSymbol: Symbol, dontResolveAlias?: boolean): Symbol {
|
||||
return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports.get("export=" as __String), dontResolveAlias)) || moduleSymbol;
|
||||
return moduleSymbol && getMergedSymbol(resolveSymbol(moduleSymbol.exports.get(InternalSymbolName.ExportEquals), dontResolveAlias)) || moduleSymbol;
|
||||
}
|
||||
|
||||
// An external module with an 'export =' declaration may be referenced as an ES6 module provided the 'export ='
|
||||
@ -1772,7 +1772,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function hasExportAssignmentSymbol(moduleSymbol: Symbol): boolean {
|
||||
return moduleSymbol.exports.get("export=" as __String) !== undefined;
|
||||
return moduleSymbol.exports.get(InternalSymbolName.ExportEquals) !== undefined;
|
||||
}
|
||||
|
||||
function getExportsOfModuleAsArray(moduleSymbol: Symbol): Symbol[] {
|
||||
@ -16402,12 +16402,35 @@ namespace ts {
|
||||
if (moduleSymbol) {
|
||||
const esModuleSymbol = resolveESModuleSymbol(moduleSymbol, specifier, /*dontRecursivelyResolve*/ true);
|
||||
if (esModuleSymbol) {
|
||||
return createPromiseReturnType(node, getTypeOfSymbol(esModuleSymbol));
|
||||
return createPromiseReturnType(node, getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol));
|
||||
}
|
||||
}
|
||||
return createPromiseReturnType(node, anyType);
|
||||
}
|
||||
|
||||
function getTypeWithSyntheticDefaultImportType(type: Type, symbol: Symbol): Type {
|
||||
if (allowSyntheticDefaultImports && type && type !== unknownType) {
|
||||
const synthType = type as SyntheticDefaultModuleType;
|
||||
if (!synthType.syntheticType) {
|
||||
if (!getPropertyOfType(type, InternalSymbolName.Default)) {
|
||||
const memberTable = createSymbolTable();
|
||||
const newSymbol = createSymbol(SymbolFlags.Alias, InternalSymbolName.Default);
|
||||
newSymbol.target = resolveSymbol(symbol);
|
||||
memberTable.set(InternalSymbolName.Default, newSymbol);
|
||||
const anonymousSymbol = createSymbol(SymbolFlags.TypeLiteral, InternalSymbolName.Type);
|
||||
const defaultContainingObject = createAnonymousType(anonymousSymbol, memberTable, emptyArray, emptyArray, /*stringIndexInfo*/ undefined, /*numberIndexInfo*/ undefined);
|
||||
anonymousSymbol.type = defaultContainingObject;
|
||||
synthType.syntheticType = getIntersectionType([type, defaultContainingObject]);
|
||||
}
|
||||
else {
|
||||
synthType.syntheticType = type;
|
||||
}
|
||||
}
|
||||
return synthType.syntheticType;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
function isCommonJsRequire(node: Node) {
|
||||
if (!isRequireCall(node, /*checkArgumentIsStringLiteral*/ true)) {
|
||||
return false;
|
||||
|
||||
@ -3318,6 +3318,11 @@ namespace ts {
|
||||
awaitedTypeOfType?: Type;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface SyntheticDefaultModuleType extends Type {
|
||||
syntheticType?: Type;
|
||||
}
|
||||
|
||||
export interface TypeVariable extends Type {
|
||||
/* @internal */
|
||||
resolvedBaseConstraint: Type;
|
||||
|
||||
@ -3,9 +3,9 @@ export async function fn() {
|
||||
>fn : () => Promise<void>
|
||||
|
||||
const req = await import('./test') // ONE
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }>
|
||||
>'./test' : "./test"
|
||||
}
|
||||
|
||||
@ -16,9 +16,9 @@ export class cl1 {
|
||||
>m : () => Promise<void>
|
||||
|
||||
const req = await import('./test') // TWO
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }>
|
||||
>'./test' : "./test"
|
||||
}
|
||||
}
|
||||
@ -32,9 +32,9 @@ export const obj = {
|
||||
>async () => { const req = await import('./test') // THREE } : () => Promise<void>
|
||||
|
||||
const req = await import('./test') // THREE
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }>
|
||||
>'./test' : "./test"
|
||||
}
|
||||
}
|
||||
@ -51,9 +51,9 @@ export class cl2 {
|
||||
>async () => { const req = await import('./test') // FOUR } : () => Promise<void>
|
||||
|
||||
const req = await import('./test') // FOUR
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }>
|
||||
>'./test' : "./test"
|
||||
}
|
||||
}
|
||||
@ -64,9 +64,9 @@ export const l = async () => {
|
||||
>async () => { const req = await import('./test') // FIVE} : () => Promise<void>
|
||||
|
||||
const req = await import('./test') // FIVE
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }>
|
||||
>'./test' : "./test"
|
||||
}
|
||||
|
||||
|
||||
@ -3,9 +3,9 @@ export async function fn() {
|
||||
>fn : () => Promise<void>
|
||||
|
||||
const req = await import('./test') // ONE
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }>
|
||||
>'./test' : "./test"
|
||||
}
|
||||
|
||||
@ -16,9 +16,9 @@ export class cl1 {
|
||||
>m : () => Promise<void>
|
||||
|
||||
const req = await import('./test') // TWO
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }>
|
||||
>'./test' : "./test"
|
||||
}
|
||||
}
|
||||
@ -32,9 +32,9 @@ export const obj = {
|
||||
>async () => { const req = await import('./test') // THREE } : () => Promise<void>
|
||||
|
||||
const req = await import('./test') // THREE
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }>
|
||||
>'./test' : "./test"
|
||||
}
|
||||
}
|
||||
@ -51,9 +51,9 @@ export class cl2 {
|
||||
>async () => { const req = await import('./test') // FOUR } : () => Promise<void>
|
||||
|
||||
const req = await import('./test') // FOUR
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }>
|
||||
>'./test' : "./test"
|
||||
}
|
||||
}
|
||||
@ -64,9 +64,9 @@ export const l = async () => {
|
||||
>async () => { const req = await import('./test') // FIVE} : () => Promise<void>
|
||||
|
||||
const req = await import('./test') // FIVE
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }>
|
||||
>'./test' : "./test"
|
||||
}
|
||||
|
||||
|
||||
@ -3,9 +3,9 @@ export async function fn() {
|
||||
>fn : () => Promise<void>
|
||||
|
||||
const req = await import('./test') // ONE
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }>
|
||||
>'./test' : "./test"
|
||||
}
|
||||
|
||||
@ -16,9 +16,9 @@ export class cl1 {
|
||||
>m : () => Promise<void>
|
||||
|
||||
const req = await import('./test') // TWO
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }>
|
||||
>'./test' : "./test"
|
||||
}
|
||||
}
|
||||
@ -32,9 +32,9 @@ export const obj = {
|
||||
>async () => { const req = await import('./test') // THREE } : () => Promise<void>
|
||||
|
||||
const req = await import('./test') // THREE
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }>
|
||||
>'./test' : "./test"
|
||||
}
|
||||
}
|
||||
@ -51,9 +51,9 @@ export class cl2 {
|
||||
>async () => { const req = await import('./test') // FOUR } : () => Promise<void>
|
||||
|
||||
const req = await import('./test') // FOUR
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }>
|
||||
>'./test' : "./test"
|
||||
}
|
||||
}
|
||||
@ -64,9 +64,9 @@ export const l = async () => {
|
||||
>async () => { const req = await import('./test') // FIVE} : () => Promise<void>
|
||||
|
||||
const req = await import('./test') // FIVE
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test"
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test">
|
||||
>req : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>await import('./test') : typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }
|
||||
>import('./test') : Promise<typeof "tests/cases/conformance/dynamicImport/test" & { default: typeof "tests/cases/conformance/dynamicImport/test"; }>
|
||||
>'./test' : "./test"
|
||||
}
|
||||
|
||||
|
||||
@ -5,41 +5,41 @@ export function foo() { return "foo"; }
|
||||
|
||||
=== tests/cases/conformance/dynamicImport/1.ts ===
|
||||
import("./0");
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
|
||||
var p1 = import("./0");
|
||||
>p1 : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>p1 : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
|
||||
p1.then(zero => {
|
||||
>p1.then(zero => { return zero.foo();}) : Promise<string>
|
||||
>p1.then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>p1 : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>zero => { return zero.foo();} : (zero: typeof "tests/cases/conformance/dynamicImport/0") => string
|
||||
>zero : typeof "tests/cases/conformance/dynamicImport/0"
|
||||
>p1.then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }, TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>p1 : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }, TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>zero => { return zero.foo();} : (zero: typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }) => string
|
||||
>zero : typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }
|
||||
|
||||
return zero.foo();
|
||||
>zero.foo() : string
|
||||
>zero.foo : () => string
|
||||
>zero : typeof "tests/cases/conformance/dynamicImport/0"
|
||||
>zero : typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }
|
||||
>foo : () => string
|
||||
|
||||
});
|
||||
|
||||
export var p2 = import("./0");
|
||||
>p2 : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>p2 : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
|
||||
function foo() {
|
||||
>foo : () => void
|
||||
|
||||
const p2 = import("./0");
|
||||
>p2 : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>p2 : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
}
|
||||
|
||||
@ -50,8 +50,8 @@ class C {
|
||||
>method : () => void
|
||||
|
||||
const loadAsync = import ("./0");
|
||||
>loadAsync : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import ("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>loadAsync : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>import ("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
}
|
||||
}
|
||||
@ -63,8 +63,8 @@ export class D {
|
||||
>method : () => void
|
||||
|
||||
const loadAsync = import ("./0");
|
||||
>loadAsync : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import ("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>loadAsync : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>import ("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,41 +5,41 @@ export function foo() { return "foo"; }
|
||||
|
||||
=== tests/cases/conformance/dynamicImport/1.ts ===
|
||||
import("./0");
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
|
||||
var p1 = import("./0");
|
||||
>p1 : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>p1 : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
|
||||
p1.then(zero => {
|
||||
>p1.then(zero => { return zero.foo();}) : Promise<string>
|
||||
>p1.then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>p1 : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>zero => { return zero.foo();} : (zero: typeof "tests/cases/conformance/dynamicImport/0") => string
|
||||
>zero : typeof "tests/cases/conformance/dynamicImport/0"
|
||||
>p1.then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }, TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>p1 : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }, TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>zero => { return zero.foo();} : (zero: typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }) => string
|
||||
>zero : typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }
|
||||
|
||||
return zero.foo();
|
||||
>zero.foo() : string
|
||||
>zero.foo : () => string
|
||||
>zero : typeof "tests/cases/conformance/dynamicImport/0"
|
||||
>zero : typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }
|
||||
>foo : () => string
|
||||
|
||||
});
|
||||
|
||||
export var p2 = import("./0");
|
||||
>p2 : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>p2 : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
|
||||
function foo() {
|
||||
>foo : () => void
|
||||
|
||||
const p2 = import("./0");
|
||||
>p2 : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>p2 : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
}
|
||||
|
||||
@ -50,8 +50,8 @@ class C {
|
||||
>method : () => void
|
||||
|
||||
const loadAsync = import ("./0");
|
||||
>loadAsync : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import ("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>loadAsync : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>import ("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
}
|
||||
}
|
||||
@ -63,8 +63,8 @@ export class D {
|
||||
>method : () => void
|
||||
|
||||
const loadAsync = import ("./0");
|
||||
>loadAsync : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import ("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>loadAsync : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>import ("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,40 +5,40 @@ export function foo() { return "foo"; }
|
||||
|
||||
=== tests/cases/conformance/dynamicImport/1.ts ===
|
||||
import("./0");
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
|
||||
var p1 = import("./0");
|
||||
>p1 : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>p1 : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
|
||||
p1.then(zero => {
|
||||
>p1.then(zero => { return zero.foo();}) : Promise<string>
|
||||
>p1.then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>p1 : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>zero => { return zero.foo();} : (zero: typeof "tests/cases/conformance/dynamicImport/0") => string
|
||||
>zero : typeof "tests/cases/conformance/dynamicImport/0"
|
||||
>p1.then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }, TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>p1 : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }, TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>zero => { return zero.foo();} : (zero: typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }) => string
|
||||
>zero : typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }
|
||||
|
||||
return zero.foo();
|
||||
>zero.foo() : string
|
||||
>zero.foo : () => string
|
||||
>zero : typeof "tests/cases/conformance/dynamicImport/0"
|
||||
>zero : typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }
|
||||
>foo : () => string
|
||||
|
||||
});
|
||||
|
||||
export var p2 = import("./0");
|
||||
>p2 : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>p2 : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
|
||||
function foo() {
|
||||
>foo : () => void
|
||||
|
||||
const p2 = import("./0");
|
||||
>p2 : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>p2 : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
}
|
||||
|
||||
@ -41,6 +41,6 @@ function foo(x: Promise<any>) {
|
||||
foo(import("./0"));
|
||||
>foo(import("./0")) : void
|
||||
>foo : (x: Promise<any>) => void
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
|
||||
|
||||
@ -14,9 +14,9 @@ async function foo() {
|
||||
class C extends (await import("./0")).B {}
|
||||
>C : C
|
||||
>(await import("./0")).B : B
|
||||
>(await import("./0")) : typeof "tests/cases/conformance/dynamicImport/0"
|
||||
>await import("./0") : typeof "tests/cases/conformance/dynamicImport/0"
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>(await import("./0")) : typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }
|
||||
>await import("./0") : typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
>B : typeof B
|
||||
|
||||
|
||||
@ -24,27 +24,27 @@ class C {
|
||||
>C : C
|
||||
|
||||
private myModule = import("./0");
|
||||
>myModule : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>myModule : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
|
||||
method() {
|
||||
>method : () => void
|
||||
|
||||
const loadAsync = import("./0");
|
||||
>loadAsync : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>loadAsync : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
|
||||
this.myModule.then(Zero => {
|
||||
>this.myModule.then(Zero => { console.log(Zero.foo()); }, async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); }) : Promise<void>
|
||||
>this.myModule.then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>this.myModule : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>this.myModule.then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }, TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>this.myModule : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>this : this
|
||||
>myModule : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>Zero => { console.log(Zero.foo()); } : (Zero: typeof "tests/cases/conformance/dynamicImport/0") => void
|
||||
>Zero : typeof "tests/cases/conformance/dynamicImport/0"
|
||||
>myModule : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }, TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>Zero => { console.log(Zero.foo()); } : (Zero: typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }) => void
|
||||
>Zero : typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }
|
||||
|
||||
console.log(Zero.foo());
|
||||
>console.log(Zero.foo()) : any
|
||||
@ -53,7 +53,7 @@ class C {
|
||||
>log : any
|
||||
>Zero.foo() : string
|
||||
>Zero.foo : () => string
|
||||
>Zero : typeof "tests/cases/conformance/dynamicImport/0"
|
||||
>Zero : typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }
|
||||
>foo : () => string
|
||||
|
||||
}, async err => {
|
||||
@ -68,9 +68,9 @@ class C {
|
||||
>err : any
|
||||
|
||||
let one = await import("./1");
|
||||
>one : typeof "tests/cases/conformance/dynamicImport/1"
|
||||
>await import("./1") : typeof "tests/cases/conformance/dynamicImport/1"
|
||||
>import("./1") : Promise<typeof "tests/cases/conformance/dynamicImport/1">
|
||||
>one : typeof "tests/cases/conformance/dynamicImport/1" & { default: typeof "tests/cases/conformance/dynamicImport/1"; }
|
||||
>await import("./1") : typeof "tests/cases/conformance/dynamicImport/1" & { default: typeof "tests/cases/conformance/dynamicImport/1"; }
|
||||
>import("./1") : Promise<typeof "tests/cases/conformance/dynamicImport/1" & { default: typeof "tests/cases/conformance/dynamicImport/1"; }>
|
||||
>"./1" : "./1"
|
||||
|
||||
console.log(one.backup());
|
||||
@ -80,7 +80,7 @@ class C {
|
||||
>log : any
|
||||
>one.backup() : string
|
||||
>one.backup : () => string
|
||||
>one : typeof "tests/cases/conformance/dynamicImport/1"
|
||||
>one : typeof "tests/cases/conformance/dynamicImport/1" & { default: typeof "tests/cases/conformance/dynamicImport/1"; }
|
||||
>backup : () => string
|
||||
|
||||
});
|
||||
@ -91,27 +91,27 @@ export class D {
|
||||
>D : D
|
||||
|
||||
private myModule = import("./0");
|
||||
>myModule : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>myModule : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
|
||||
method() {
|
||||
>method : () => void
|
||||
|
||||
const loadAsync = import("./0");
|
||||
>loadAsync : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>loadAsync : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>import("./0") : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>"./0" : "./0"
|
||||
|
||||
this.myModule.then(Zero => {
|
||||
>this.myModule.then(Zero => { console.log(Zero.foo()); }, async err => { console.log(err); let one = await import("./1"); console.log(one.backup()); }) : Promise<void>
|
||||
>this.myModule.then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>this.myModule : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>this.myModule.then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }, TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>this.myModule : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>this : this
|
||||
>myModule : Promise<typeof "tests/cases/conformance/dynamicImport/0">
|
||||
>then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0", TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0") => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>Zero => { console.log(Zero.foo()); } : (Zero: typeof "tests/cases/conformance/dynamicImport/0") => void
|
||||
>Zero : typeof "tests/cases/conformance/dynamicImport/0"
|
||||
>myModule : Promise<typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }>
|
||||
>then : <TResult1 = typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }, TResult2 = never>(onfulfilled?: (value: typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>Zero => { console.log(Zero.foo()); } : (Zero: typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }) => void
|
||||
>Zero : typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }
|
||||
|
||||
console.log(Zero.foo());
|
||||
>console.log(Zero.foo()) : any
|
||||
@ -120,7 +120,7 @@ export class D {
|
||||
>log : any
|
||||
>Zero.foo() : string
|
||||
>Zero.foo : () => string
|
||||
>Zero : typeof "tests/cases/conformance/dynamicImport/0"
|
||||
>Zero : typeof "tests/cases/conformance/dynamicImport/0" & { default: typeof "tests/cases/conformance/dynamicImport/0"; }
|
||||
>foo : () => string
|
||||
|
||||
}, async err => {
|
||||
@ -135,9 +135,9 @@ export class D {
|
||||
>err : any
|
||||
|
||||
let one = await import("./1");
|
||||
>one : typeof "tests/cases/conformance/dynamicImport/1"
|
||||
>await import("./1") : typeof "tests/cases/conformance/dynamicImport/1"
|
||||
>import("./1") : Promise<typeof "tests/cases/conformance/dynamicImport/1">
|
||||
>one : typeof "tests/cases/conformance/dynamicImport/1" & { default: typeof "tests/cases/conformance/dynamicImport/1"; }
|
||||
>await import("./1") : typeof "tests/cases/conformance/dynamicImport/1" & { default: typeof "tests/cases/conformance/dynamicImport/1"; }
|
||||
>import("./1") : Promise<typeof "tests/cases/conformance/dynamicImport/1" & { default: typeof "tests/cases/conformance/dynamicImport/1"; }>
|
||||
>"./1" : "./1"
|
||||
|
||||
console.log(one.backup());
|
||||
@ -147,7 +147,7 @@ export class D {
|
||||
>log : any
|
||||
>one.backup() : string
|
||||
>one.backup : () => string
|
||||
>one : typeof "tests/cases/conformance/dynamicImport/1"
|
||||
>one : typeof "tests/cases/conformance/dynamicImport/1" & { default: typeof "tests/cases/conformance/dynamicImport/1"; }
|
||||
>backup : () => string
|
||||
|
||||
});
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
//// [tests/cases/compiler/syntheticDefaultExportsWithDynamicImports.ts] ////
|
||||
|
||||
//// [index.d.ts]
|
||||
declare function packageExport(x: number): string;
|
||||
export = packageExport;
|
||||
|
||||
//// [index.ts]
|
||||
import("package").then(({default: foo}) => foo(42));
|
||||
|
||||
//// [index.js]
|
||||
System.register([], function (exports_1, context_1) {
|
||||
var __moduleName = context_1 && context_1.id;
|
||||
return {
|
||||
setters: [],
|
||||
execute: function () {
|
||||
context_1.import("package").then(({ default: foo }) => foo(42));
|
||||
}
|
||||
};
|
||||
});
|
||||
@ -0,0 +1,17 @@
|
||||
=== tests/cases/compiler/node_modules/package/index.d.ts ===
|
||||
declare function packageExport(x: number): string;
|
||||
>packageExport : Symbol(packageExport, Decl(index.d.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(index.d.ts, 0, 31))
|
||||
|
||||
export = packageExport;
|
||||
>packageExport : Symbol(packageExport, Decl(index.d.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
import("package").then(({default: foo}) => foo(42));
|
||||
>import("package").then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
|
||||
>"package" : Symbol("tests/cases/compiler/node_modules/package/index", Decl(index.d.ts, 0, 0))
|
||||
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
|
||||
>default : Symbol(default)
|
||||
>foo : Symbol(foo, Decl(index.ts, 0, 25))
|
||||
>foo : Symbol(foo, Decl(index.ts, 0, 25))
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
=== tests/cases/compiler/node_modules/package/index.d.ts ===
|
||||
declare function packageExport(x: number): string;
|
||||
>packageExport : (x: number) => string
|
||||
>x : number
|
||||
|
||||
export = packageExport;
|
||||
>packageExport : (x: number) => string
|
||||
|
||||
=== tests/cases/compiler/index.ts ===
|
||||
import("package").then(({default: foo}) => foo(42));
|
||||
>import("package").then(({default: foo}) => foo(42)) : Promise<string>
|
||||
>import("package").then : <TResult1 = ((x: number) => string) & { default: (x: number) => string; }, TResult2 = never>(onfulfilled?: (value: ((x: number) => string) & { default: (x: number) => string; }) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>import("package") : Promise<((x: number) => string) & { default: (x: number) => string; }>
|
||||
>"package" : "package"
|
||||
>then : <TResult1 = ((x: number) => string) & { default: (x: number) => string; }, TResult2 = never>(onfulfilled?: (value: ((x: number) => string) & { default: (x: number) => string; }) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
|
||||
>({default: foo}) => foo(42) : ({ default: foo }: ((x: number) => string) & { default: (x: number) => string; }) => string
|
||||
>default : any
|
||||
>foo : (x: number) => string
|
||||
>foo(42) : string
|
||||
>foo : (x: number) => string
|
||||
>42 : 42
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
// @module: system
|
||||
// @target: es6
|
||||
// @moduleResolution: node
|
||||
// @filename: node_modules/package/index.d.ts
|
||||
declare function packageExport(x: number): string;
|
||||
export = packageExport;
|
||||
|
||||
// @filename: index.ts
|
||||
import("package").then(({default: foo}) => foo(42));
|
||||
Loading…
x
Reference in New Issue
Block a user