mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-16 15:44:16 -06:00
Merge branch 'transforms' into transforms-generators
This commit is contained in:
commit
4eb2a82dca
@ -1765,7 +1765,7 @@ namespace ts {
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.EnumMember, SymbolFlags.EnumMemberExcludes);
|
||||
|
||||
case SyntaxKind.JsxSpreadAttribute:
|
||||
emitFlags |= NodeFlags.HasJsxSpreadAttribute;
|
||||
emitFlags |= NodeFlags.HasJsxSpreadAttributes;
|
||||
return;
|
||||
|
||||
case SyntaxKind.CallSignature:
|
||||
|
||||
@ -1264,10 +1264,13 @@ namespace ts {
|
||||
}
|
||||
|
||||
const moduleReferenceLiteral = <LiteralExpression>moduleReferenceExpression;
|
||||
return resolveExternalModule(location, moduleReferenceLiteral.text, moduleNotFoundError, moduleReferenceLiteral);
|
||||
}
|
||||
|
||||
function resolveExternalModule(location: Node, moduleReference: string, moduleNotFoundError: DiagnosticMessage, errorNode: Node): Symbol {
|
||||
// Module names are escaped in our symbol table. However, string literal values aren't.
|
||||
// Escape the name in the "require(...)" clause to ensure we find the right symbol.
|
||||
const moduleName = escapeIdentifier(moduleReferenceLiteral.text);
|
||||
const moduleName = escapeIdentifier(moduleReference);
|
||||
|
||||
if (moduleName === undefined) {
|
||||
return;
|
||||
@ -1282,7 +1285,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
const resolvedModule = getResolvedModule(getSourceFileOfNode(location), moduleReferenceLiteral.text);
|
||||
const resolvedModule = getResolvedModule(getSourceFileOfNode(location), moduleReference);
|
||||
const sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName);
|
||||
if (sourceFile) {
|
||||
if (sourceFile.symbol) {
|
||||
@ -1291,7 +1294,7 @@ namespace ts {
|
||||
}
|
||||
if (moduleNotFoundError) {
|
||||
// report errors only if it was requested
|
||||
error(moduleReferenceLiteral, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
|
||||
error(errorNode, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@ -1305,7 +1308,7 @@ namespace ts {
|
||||
|
||||
if (moduleNotFoundError) {
|
||||
// report errors only if it was requested
|
||||
error(moduleReferenceLiteral, moduleNotFoundError, moduleName);
|
||||
error(errorNode, moduleNotFoundError, moduleName);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@ -17445,6 +17448,11 @@ namespace ts {
|
||||
|
||||
function isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean {
|
||||
node = getParseTreeNode(node);
|
||||
// Purely synthesized nodes are always emitted.
|
||||
if (node === undefined) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isAliasSymbolDeclaration(node)) {
|
||||
const symbol = getSymbolOfNode(node);
|
||||
if (symbol && getSymbolLinks(symbol).referenced) {
|
||||
@ -17759,27 +17767,37 @@ namespace ts {
|
||||
|
||||
function initializeTypeChecker() {
|
||||
// Bind all source files and propagate errors
|
||||
forEach(host.getSourceFiles(), file => {
|
||||
for (const file of host.getSourceFiles()) {
|
||||
bindSourceFile(file, compilerOptions);
|
||||
});
|
||||
}
|
||||
|
||||
let augmentations: LiteralExpression[][];
|
||||
// Initialize global symbol table
|
||||
forEach(host.getSourceFiles(), file => {
|
||||
let augmentations: LiteralExpression[][];
|
||||
let requestedExternalEmitHelpers: NodeFlags = 0;
|
||||
let firstFileRequestingExternalHelpers: SourceFile;
|
||||
for (const file of host.getSourceFiles()) {
|
||||
if (!isExternalOrCommonJsModule(file)) {
|
||||
mergeSymbolTable(globals, file.locals);
|
||||
}
|
||||
if (file.patternAmbientModules && file.patternAmbientModules.length) {
|
||||
patternAmbientModules = concatenate(patternAmbientModules, file.patternAmbientModules);
|
||||
}
|
||||
|
||||
if (file.moduleAugmentations.length) {
|
||||
(augmentations || (augmentations = [])).push(file.moduleAugmentations);
|
||||
}
|
||||
if (file.symbol && file.symbol.globalExports) {
|
||||
mergeSymbolTable(globals, file.symbol.globalExports);
|
||||
}
|
||||
});
|
||||
if ((compilerOptions.isolatedModules || isExternalModule(file)) && !file.isDeclarationFile) {
|
||||
const fileRequestedExternalEmitHelpers = file.flags & NodeFlags.EmitHelperFlags;
|
||||
if (fileRequestedExternalEmitHelpers) {
|
||||
requestedExternalEmitHelpers |= fileRequestedExternalEmitHelpers;
|
||||
if (firstFileRequestingExternalHelpers === undefined) {
|
||||
firstFileRequestingExternalHelpers = file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (augmentations) {
|
||||
// merge module augmentations.
|
||||
@ -17842,6 +17860,48 @@ namespace ts {
|
||||
const symbol = getGlobalSymbol("ReadonlyArray", SymbolFlags.Type, /*diagnostic*/ undefined);
|
||||
globalReadonlyArrayType = symbol && <GenericType>getTypeOfGlobalSymbol(symbol, /*arity*/ 1);
|
||||
anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType;
|
||||
|
||||
// If we have specified that we are importing helpers, we should report global
|
||||
// errors if we cannot resolve the helpers external module, or if it does not have
|
||||
// the necessary helpers exported.
|
||||
if (compilerOptions.importHelpers && firstFileRequestingExternalHelpers) {
|
||||
// Find the first reference to the helpers module.
|
||||
const helpersModule = resolveExternalModule(
|
||||
firstFileRequestingExternalHelpers,
|
||||
externalHelpersModuleNameText,
|
||||
Diagnostics.Cannot_find_module_0,
|
||||
/*errorNode*/ undefined);
|
||||
|
||||
// If we found the module, report errors if it does not have the necessary exports.
|
||||
if (helpersModule) {
|
||||
const exports = helpersModule.exports;
|
||||
if (requestedExternalEmitHelpers & NodeFlags.HasClassExtends && languageVersion < ScriptTarget.ES6) {
|
||||
verifyHelperSymbol(exports, "__extends", SymbolFlags.Value);
|
||||
}
|
||||
if (requestedExternalEmitHelpers & NodeFlags.HasJsxSpreadAttributes && compilerOptions.jsx !== JsxEmit.Preserve) {
|
||||
verifyHelperSymbol(exports, "__assign", SymbolFlags.Value);
|
||||
}
|
||||
if (requestedExternalEmitHelpers & NodeFlags.HasDecorators) {
|
||||
verifyHelperSymbol(exports, "__decorate", SymbolFlags.Value);
|
||||
if (compilerOptions.emitDecoratorMetadata) {
|
||||
verifyHelperSymbol(exports, "__metadata", SymbolFlags.Value);
|
||||
}
|
||||
}
|
||||
if (requestedExternalEmitHelpers & NodeFlags.HasParamDecorators) {
|
||||
verifyHelperSymbol(exports, "__param", SymbolFlags.Value);
|
||||
}
|
||||
if (requestedExternalEmitHelpers & NodeFlags.HasAsyncFunctions) {
|
||||
verifyHelperSymbol(exports, "__awaiter", SymbolFlags.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function verifyHelperSymbol(symbols: SymbolTable, name: string, meaning: SymbolFlags) {
|
||||
const symbol = getSymbol(symbols, escapeIdentifier(name), meaning);
|
||||
if (!symbol) {
|
||||
error(/*location*/ undefined, Diagnostics.Module_0_has_no_exported_member_1, externalHelpersModuleNameText, name);
|
||||
}
|
||||
}
|
||||
|
||||
function createInstantiatedPromiseLikeType(): ObjectType {
|
||||
|
||||
@ -421,6 +421,11 @@ namespace ts {
|
||||
name: "strictNullChecks",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Enable_strict_null_checks
|
||||
},
|
||||
{
|
||||
name: "importHelpers",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Import_emit_helpers_from_tslib
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@ -2772,6 +2772,10 @@
|
||||
"category": "Message",
|
||||
"code": 6132
|
||||
},
|
||||
"Import emit helpers from 'tslib'.": {
|
||||
"category": "Message",
|
||||
"code": 6133
|
||||
},
|
||||
|
||||
"Variable '{0}' implicitly has an '{1}' type.": {
|
||||
"category": "Error",
|
||||
|
||||
@ -2171,52 +2171,60 @@ const _super = (function (geti, seti) {
|
||||
}
|
||||
|
||||
function emitEmitHelpers(node: SourceFile) {
|
||||
// Only emit helpers if the user did not say otherwise.
|
||||
if (compilerOptions.noEmitHelpers) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't emit helpers if we can import them.
|
||||
if (compilerOptions.importHelpers
|
||||
&& (isExternalModule(node) || compilerOptions.isolatedModules)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let helpersEmitted = false;
|
||||
|
||||
// Only emit helpers if the user did not say otherwise.
|
||||
if (!compilerOptions.noEmitHelpers) {
|
||||
// Only Emit __extends function when target ES5.
|
||||
// For target ES6 and above, we can emit classDeclaration as is.
|
||||
if ((languageVersion < ScriptTarget.ES6) && (!extendsEmitted && node.flags & NodeFlags.HasClassExtends)) {
|
||||
writeLines(extendsHelper);
|
||||
extendsEmitted = true;
|
||||
helpersEmitted = true;
|
||||
// Only Emit __extends function when target ES5.
|
||||
// For target ES6 and above, we can emit classDeclaration as is.
|
||||
if ((languageVersion < ScriptTarget.ES6) && (!extendsEmitted && node.flags & NodeFlags.HasClassExtends)) {
|
||||
writeLines(extendsHelper);
|
||||
extendsEmitted = true;
|
||||
helpersEmitted = true;
|
||||
}
|
||||
|
||||
if (compilerOptions.jsx !== JsxEmit.Preserve && !assignEmitted && (node.flags & NodeFlags.HasJsxSpreadAttributes)) {
|
||||
writeLines(assignHelper);
|
||||
assignEmitted = true;
|
||||
}
|
||||
|
||||
if (!decorateEmitted && node.flags & NodeFlags.HasDecorators) {
|
||||
writeLines(decorateHelper);
|
||||
if (compilerOptions.emitDecoratorMetadata) {
|
||||
writeLines(metadataHelper);
|
||||
}
|
||||
|
||||
if (compilerOptions.jsx !== JsxEmit.Preserve && !assignEmitted && (node.flags & NodeFlags.HasJsxSpreadAttribute)) {
|
||||
writeLines(assignHelper);
|
||||
assignEmitted = true;
|
||||
decorateEmitted = true;
|
||||
helpersEmitted = true;
|
||||
}
|
||||
|
||||
if (!paramEmitted && node.flags & NodeFlags.HasParamDecorators) {
|
||||
writeLines(paramHelper);
|
||||
paramEmitted = true;
|
||||
helpersEmitted = true;
|
||||
}
|
||||
|
||||
if (!awaiterEmitted && node.flags & NodeFlags.HasAsyncFunctions) {
|
||||
writeLines(awaiterHelper);
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
writeLines(generatorHelper);
|
||||
}
|
||||
|
||||
if (!decorateEmitted && node.flags & NodeFlags.HasDecorators) {
|
||||
writeLines(decorateHelper);
|
||||
if (compilerOptions.emitDecoratorMetadata) {
|
||||
writeLines(metadataHelper);
|
||||
}
|
||||
awaiterEmitted = true;
|
||||
helpersEmitted = true;
|
||||
}
|
||||
|
||||
decorateEmitted = true;
|
||||
helpersEmitted = true;
|
||||
}
|
||||
|
||||
if (!paramEmitted && node.flags & NodeFlags.HasParamDecorators) {
|
||||
writeLines(paramHelper);
|
||||
paramEmitted = true;
|
||||
helpersEmitted = true;
|
||||
}
|
||||
|
||||
if (!awaiterEmitted && node.flags & NodeFlags.HasAsyncFunctions) {
|
||||
writeLines(awaiterHelper);
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
writeLines(generatorHelper);
|
||||
}
|
||||
|
||||
awaiterEmitted = true;
|
||||
helpersEmitted = true;
|
||||
}
|
||||
|
||||
if (helpersEmitted) {
|
||||
writeLine();
|
||||
}
|
||||
if (helpersEmitted) {
|
||||
writeLine();
|
||||
}
|
||||
|
||||
return helpersEmitted;
|
||||
|
||||
@ -853,30 +853,31 @@ namespace ts {
|
||||
updated.fileName = node.fileName;
|
||||
updated.path = node.path;
|
||||
updated.text = node.text;
|
||||
updated.amdDependencies = node.amdDependencies;
|
||||
updated.moduleName = node.moduleName;
|
||||
updated.referencedFiles = node.referencedFiles;
|
||||
updated.typeReferenceDirectives = node.typeReferenceDirectives;
|
||||
updated.languageVariant = node.languageVariant;
|
||||
updated.isDeclarationFile = node.isDeclarationFile;
|
||||
updated.renamedDependencies = node.renamedDependencies;
|
||||
updated.hasNoDefaultLib = node.hasNoDefaultLib;
|
||||
updated.languageVersion = node.languageVersion;
|
||||
updated.scriptKind = node.scriptKind;
|
||||
updated.externalModuleIndicator = node.externalModuleIndicator;
|
||||
updated.commonJsModuleIndicator = node.commonJsModuleIndicator;
|
||||
updated.identifiers = node.identifiers;
|
||||
updated.nodeCount = node.nodeCount;
|
||||
updated.identifierCount = node.identifierCount;
|
||||
updated.symbolCount = node.symbolCount;
|
||||
updated.parseDiagnostics = node.parseDiagnostics;
|
||||
updated.bindDiagnostics = node.bindDiagnostics;
|
||||
updated.lineMap = node.lineMap;
|
||||
updated.classifiableNames = node.classifiableNames;
|
||||
updated.resolvedModules = node.resolvedModules;
|
||||
updated.resolvedTypeReferenceDirectiveNames = node.resolvedTypeReferenceDirectiveNames;
|
||||
updated.imports = node.imports;
|
||||
updated.moduleAugmentations = node.moduleAugmentations;
|
||||
if (node.amdDependencies !== undefined) updated.amdDependencies = node.amdDependencies;
|
||||
if (node.moduleName !== undefined) updated.moduleName = node.moduleName;
|
||||
if (node.referencedFiles !== undefined) updated.referencedFiles = node.referencedFiles;
|
||||
if (node.typeReferenceDirectives !== undefined) updated.typeReferenceDirectives = node.typeReferenceDirectives;
|
||||
if (node.languageVariant !== undefined) updated.languageVariant = node.languageVariant;
|
||||
if (node.isDeclarationFile !== undefined) updated.isDeclarationFile = node.isDeclarationFile;
|
||||
if (node.renamedDependencies !== undefined) updated.renamedDependencies = node.renamedDependencies;
|
||||
if (node.hasNoDefaultLib !== undefined) updated.hasNoDefaultLib = node.hasNoDefaultLib;
|
||||
if (node.languageVersion !== undefined) updated.languageVersion = node.languageVersion;
|
||||
if (node.scriptKind !== undefined) updated.scriptKind = node.scriptKind;
|
||||
if (node.externalModuleIndicator !== undefined) updated.externalModuleIndicator = node.externalModuleIndicator;
|
||||
if (node.commonJsModuleIndicator !== undefined) updated.commonJsModuleIndicator = node.commonJsModuleIndicator;
|
||||
if (node.identifiers !== undefined) updated.identifiers = node.identifiers;
|
||||
if (node.nodeCount !== undefined) updated.nodeCount = node.nodeCount;
|
||||
if (node.identifierCount !== undefined) updated.identifierCount = node.identifierCount;
|
||||
if (node.symbolCount !== undefined) updated.symbolCount = node.symbolCount;
|
||||
if (node.parseDiagnostics !== undefined) updated.parseDiagnostics = node.parseDiagnostics;
|
||||
if (node.bindDiagnostics !== undefined) updated.bindDiagnostics = node.bindDiagnostics;
|
||||
if (node.lineMap !== undefined) updated.lineMap = node.lineMap;
|
||||
if (node.classifiableNames !== undefined) updated.classifiableNames = node.classifiableNames;
|
||||
if (node.resolvedModules !== undefined) updated.resolvedModules = node.resolvedModules;
|
||||
if (node.resolvedTypeReferenceDirectiveNames !== undefined) updated.resolvedTypeReferenceDirectiveNames = node.resolvedTypeReferenceDirectiveNames;
|
||||
if (node.imports !== undefined) updated.imports = node.imports;
|
||||
if (node.moduleAugmentations !== undefined) updated.moduleAugmentations = node.moduleAugmentations;
|
||||
if (node.externalHelpersModuleName !== undefined) updated.externalHelpersModuleName = node.externalHelpersModuleName;
|
||||
return updateNode(updated, node);
|
||||
}
|
||||
|
||||
@ -976,6 +977,12 @@ namespace ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
export function createNamespaceImport(name: Identifier): NamespaceImport {
|
||||
const node = <NamespaceImport>createNode(SyntaxKind.NamespaceImport);
|
||||
node.name = name;
|
||||
return node;
|
||||
}
|
||||
|
||||
export function createNamedImports(elements: NodeArray<ImportSpecifier>, location?: TextRange): NamedImports {
|
||||
const node = <NamedImports>createNode(SyntaxKind.NamedImports, location);
|
||||
node.elements = elements;
|
||||
@ -1111,9 +1118,15 @@ namespace ts {
|
||||
|
||||
// Helpers
|
||||
|
||||
export function createExtendsHelper(name: Identifier) {
|
||||
export function createHelperName(externalHelpersModuleName: Identifier | undefined, name: string) {
|
||||
return externalHelpersModuleName
|
||||
? createPropertyAccess(externalHelpersModuleName, name)
|
||||
: createIdentifier(name);
|
||||
}
|
||||
|
||||
export function createExtendsHelper(externalHelpersModuleName: Identifier | undefined, name: Identifier) {
|
||||
return createCall(
|
||||
createIdentifier("__extends"),
|
||||
createHelperName(externalHelpersModuleName, "__extends"),
|
||||
/*typeArguments*/ undefined,
|
||||
[
|
||||
name,
|
||||
@ -1122,17 +1135,17 @@ namespace ts {
|
||||
);
|
||||
}
|
||||
|
||||
export function createAssignHelper(attributesSegments: Expression[]) {
|
||||
export function createAssignHelper(externalHelpersModuleName: Identifier | undefined, attributesSegments: Expression[]) {
|
||||
return createCall(
|
||||
createIdentifier("__assign"),
|
||||
createHelperName(externalHelpersModuleName, "__assign"),
|
||||
/*typeArguments*/ undefined,
|
||||
attributesSegments
|
||||
);
|
||||
}
|
||||
|
||||
export function createParamHelper(expression: Expression, parameterOffset: number, location?: TextRange) {
|
||||
export function createParamHelper(externalHelpersModuleName: Identifier | undefined, expression: Expression, parameterOffset: number, location?: TextRange) {
|
||||
return createCall(
|
||||
createIdentifier("__param"),
|
||||
createHelperName(externalHelpersModuleName, "__param"),
|
||||
/*typeArguments*/ undefined,
|
||||
[
|
||||
createLiteral(parameterOffset),
|
||||
@ -1142,9 +1155,9 @@ namespace ts {
|
||||
);
|
||||
}
|
||||
|
||||
export function createMetadataHelper(metadataKey: string, metadataValue: Expression) {
|
||||
export function createMetadataHelper(externalHelpersModuleName: Identifier | undefined, metadataKey: string, metadataValue: Expression) {
|
||||
return createCall(
|
||||
createIdentifier("__metadata"),
|
||||
createHelperName(externalHelpersModuleName, "__metadata"),
|
||||
/*typeArguments*/ undefined,
|
||||
[
|
||||
createLiteral(metadataKey),
|
||||
@ -1153,7 +1166,7 @@ namespace ts {
|
||||
);
|
||||
}
|
||||
|
||||
export function createDecorateHelper(decoratorExpressions: Expression[], target: Expression, memberName?: Expression, descriptor?: Expression, location?: TextRange) {
|
||||
export function createDecorateHelper(externalHelpersModuleName: Identifier | undefined, decoratorExpressions: Expression[], target: Expression, memberName?: Expression, descriptor?: Expression, location?: TextRange) {
|
||||
const argumentsArray: Expression[] = [];
|
||||
argumentsArray.push(createArrayLiteral(decoratorExpressions, /*location*/ undefined, /*multiLine*/ true));
|
||||
argumentsArray.push(target);
|
||||
@ -1164,10 +1177,10 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
return createCall(createIdentifier("__decorate"), /*typeArguments*/ undefined, argumentsArray, location);
|
||||
return createCall(createHelperName(externalHelpersModuleName, "__decorate"), /*typeArguments*/ undefined, argumentsArray, location);
|
||||
}
|
||||
|
||||
export function createAwaiterHelper(hasLexicalArguments: boolean, promiseConstructor: EntityName | Expression, body: Block) {
|
||||
export function createAwaiterHelper(externalHelpersModuleName: Identifier | undefined, hasLexicalArguments: boolean, promiseConstructor: EntityName | Expression, body: Block) {
|
||||
const generatorFunc = createFunctionExpression(
|
||||
createNode(SyntaxKind.AsteriskToken),
|
||||
/*name*/ undefined,
|
||||
@ -1181,7 +1194,7 @@ namespace ts {
|
||||
generatorFunc.emitFlags |= NodeEmitFlags.AsyncFunctionBody;
|
||||
|
||||
return createCall(
|
||||
createIdentifier("__awaiter"),
|
||||
createHelperName(externalHelpersModuleName, "__awaiter"),
|
||||
/*typeArguments*/ undefined,
|
||||
[
|
||||
createThis(),
|
||||
@ -2100,7 +2113,8 @@ namespace ts {
|
||||
export function getLocalNameForExternalImport(node: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration, sourceFile: SourceFile): Identifier {
|
||||
const namespaceDeclaration = getNamespaceDeclarationNode(node);
|
||||
if (namespaceDeclaration && !isDefaultImport(node)) {
|
||||
return createIdentifier(getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));
|
||||
const name = namespaceDeclaration.name;
|
||||
return isGeneratedIdentifier(name) ? name : createIdentifier(getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name));
|
||||
}
|
||||
if (node.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>node).importClause) {
|
||||
return getGeneratedNameForNode(node);
|
||||
|
||||
@ -1719,6 +1719,17 @@ namespace ts {
|
||||
let imports: LiteralExpression[];
|
||||
let moduleAugmentations: LiteralExpression[];
|
||||
|
||||
// If we are importing helpers, we need to add a synthetic reference to resolve the
|
||||
// helpers library.
|
||||
if (options.importHelpers
|
||||
&& (options.isolatedModules || isExternalModuleFile)
|
||||
&& !file.isDeclarationFile) {
|
||||
const externalHelpersModuleReference = <StringLiteral>createNode(SyntaxKind.StringLiteral);
|
||||
externalHelpersModuleReference.text = externalHelpersModuleNameText;
|
||||
externalHelpersModuleReference.parent = file;
|
||||
imports = [externalHelpersModuleReference];
|
||||
}
|
||||
|
||||
for (const node of file.statements) {
|
||||
collectModuleReferences(node, /*inAmbientModule*/ false);
|
||||
if (isJavaScriptFile) {
|
||||
|
||||
@ -705,7 +705,7 @@ namespace ts {
|
||||
if (extendsClauseElement) {
|
||||
statements.push(
|
||||
createStatement(
|
||||
createExtendsHelper(getDeclarationName(node)),
|
||||
createExtendsHelper(currentSourceFile.externalHelpersModuleName, getDeclarationName(node)),
|
||||
/*location*/ extendsClauseElement
|
||||
)
|
||||
);
|
||||
|
||||
@ -7,6 +7,7 @@ namespace ts {
|
||||
|
||||
export function transformJsx(context: TransformationContext) {
|
||||
const compilerOptions = context.getCompilerOptions();
|
||||
let currentSourceFile: SourceFile;
|
||||
return transformSourceFile;
|
||||
|
||||
/**
|
||||
@ -15,7 +16,10 @@ namespace ts {
|
||||
* @param node A SourceFile node.
|
||||
*/
|
||||
function transformSourceFile(node: SourceFile) {
|
||||
return visitEachChild(node, visitor, context);
|
||||
currentSourceFile = node;
|
||||
node = visitEachChild(node, visitor, context);
|
||||
currentSourceFile = undefined;
|
||||
return node;
|
||||
}
|
||||
|
||||
function visitor(node: Node): VisitResult<Node> {
|
||||
@ -102,7 +106,7 @@ namespace ts {
|
||||
// Either emit one big object literal (no spread attribs), or
|
||||
// a call to the __assign helper.
|
||||
objectProperties = singleOrUndefined(segments)
|
||||
|| createAssignHelper(segments);
|
||||
|| createAssignHelper(currentSourceFile.externalHelpersModuleName, segments);
|
||||
}
|
||||
|
||||
const element = createReactCreateElement(
|
||||
|
||||
@ -51,6 +51,7 @@ namespace ts {
|
||||
let currentNamespace: ModuleDeclaration;
|
||||
let currentNamespaceContainerName: Identifier;
|
||||
let currentScope: SourceFile | Block | ModuleBlock | CaseBlock;
|
||||
let currentSourceFileExternalHelpersModuleName: Identifier;
|
||||
|
||||
/**
|
||||
* Keeps track of whether expression substitution has been enabled for specific edge cases.
|
||||
@ -90,11 +91,7 @@ namespace ts {
|
||||
* @param node A SourceFile node.
|
||||
*/
|
||||
function transformSourceFile(node: SourceFile) {
|
||||
currentSourceFile = node;
|
||||
currentScope = node;
|
||||
const visited = visitEachChild(node, visitor, context);
|
||||
setNodeEmitFlags(visited, NodeEmitFlags.EmitEmitHelpers | getNodeEmitFlags(node));
|
||||
return visited;
|
||||
return visitNode(node, visitor, isSourceFile);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -132,7 +129,10 @@ namespace ts {
|
||||
* @param node The node to visit.
|
||||
*/
|
||||
function visitorWorker(node: Node): VisitResult<Node> {
|
||||
if (node.transformFlags & TransformFlags.TypeScript) {
|
||||
if (node.kind === SyntaxKind.SourceFile) {
|
||||
return visitSourceFile(<SourceFile>node);
|
||||
}
|
||||
else if (node.transformFlags & TransformFlags.TypeScript) {
|
||||
// This node is explicitly marked as TypeScript, so we should transform the node.
|
||||
return visitTypeScript(node);
|
||||
}
|
||||
@ -420,6 +420,43 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function visitSourceFile(node: SourceFile) {
|
||||
currentSourceFile = node;
|
||||
|
||||
// If the source file requires any helpers and is an external module, and
|
||||
// the importHelpers compiler option is enabled, emit a synthesized import
|
||||
// statement for the helpers library.
|
||||
if (node.flags & NodeFlags.EmitHelperFlags
|
||||
&& compilerOptions.importHelpers
|
||||
&& (isExternalModule(node) || compilerOptions.isolatedModules)) {
|
||||
startLexicalEnvironment();
|
||||
const statements: Statement[] = [];
|
||||
const statementOffset = addPrologueDirectives(statements, node.statements);
|
||||
const externalHelpersModuleName = createUniqueName(externalHelpersModuleNameText);
|
||||
const externalHelpersModuleImport = createImportDeclaration(
|
||||
createImportClause(/*name*/ undefined, createNamespaceImport(externalHelpersModuleName)),
|
||||
createLiteral(externalHelpersModuleNameText)
|
||||
);
|
||||
externalHelpersModuleImport.parent = node;
|
||||
externalHelpersModuleImport.flags &= ~NodeFlags.Synthesized;
|
||||
statements.push(externalHelpersModuleImport);
|
||||
|
||||
currentSourceFileExternalHelpersModuleName = externalHelpersModuleName;
|
||||
addRange(statements, visitNodes(node.statements, visitor, isStatement, statementOffset));
|
||||
addRange(statements, endLexicalEnvironment());
|
||||
currentSourceFileExternalHelpersModuleName = undefined;
|
||||
|
||||
node = updateSourceFileNode(node, createNodeArray(statements, node.statements));
|
||||
node.externalHelpersModuleName = externalHelpersModuleName;
|
||||
}
|
||||
else {
|
||||
node = visitEachChild(node, visitor, context);
|
||||
}
|
||||
|
||||
setNodeEmitFlags(node, NodeEmitFlags.EmitEmitHelpers | node.emitFlags);
|
||||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether we should emit a __decorate call for a class declaration.
|
||||
*/
|
||||
@ -1345,6 +1382,7 @@ namespace ts {
|
||||
: undefined;
|
||||
|
||||
const helper = createDecorateHelper(
|
||||
currentSourceFileExternalHelpersModuleName,
|
||||
decoratorExpressions,
|
||||
prefix,
|
||||
memberName,
|
||||
@ -1394,6 +1432,7 @@ namespace ts {
|
||||
const expression = createAssignment(
|
||||
decoratedClassAlias,
|
||||
createDecorateHelper(
|
||||
currentSourceFileExternalHelpersModuleName,
|
||||
decoratorExpressions,
|
||||
getDeclarationName(node)
|
||||
)
|
||||
@ -1417,6 +1456,7 @@ namespace ts {
|
||||
const result = createAssignment(
|
||||
getDeclarationName(node),
|
||||
createDecorateHelper(
|
||||
currentSourceFileExternalHelpersModuleName,
|
||||
decoratorExpressions,
|
||||
getDeclarationName(node)
|
||||
),
|
||||
@ -1448,7 +1488,11 @@ namespace ts {
|
||||
if (decorators) {
|
||||
expressions = [];
|
||||
for (const decorator of decorators) {
|
||||
const helper = createParamHelper(transformDecorator(decorator), parameterOffset, /*location*/ decorator.expression);
|
||||
const helper = createParamHelper(
|
||||
currentSourceFileExternalHelpersModuleName,
|
||||
transformDecorator(decorator),
|
||||
parameterOffset,
|
||||
/*location*/ decorator.expression);
|
||||
setNodeEmitFlags(helper, NodeEmitFlags.NoComments);
|
||||
expressions.push(helper);
|
||||
}
|
||||
@ -1475,13 +1519,13 @@ namespace ts {
|
||||
function addOldTypeMetadata(node: Declaration, decoratorExpressions: Expression[]) {
|
||||
if (compilerOptions.emitDecoratorMetadata) {
|
||||
if (shouldAddTypeMetadata(node)) {
|
||||
decoratorExpressions.push(createMetadataHelper("design:type", serializeTypeOfNode(node)));
|
||||
decoratorExpressions.push(createMetadataHelper(currentSourceFileExternalHelpersModuleName, "design:type", serializeTypeOfNode(node)));
|
||||
}
|
||||
if (shouldAddParamTypesMetadata(node)) {
|
||||
decoratorExpressions.push(createMetadataHelper("design:paramtypes", serializeParameterTypesOfNode(node)));
|
||||
decoratorExpressions.push(createMetadataHelper(currentSourceFileExternalHelpersModuleName, "design:paramtypes", serializeParameterTypesOfNode(node)));
|
||||
}
|
||||
if (shouldAddReturnTypeMetadata(node)) {
|
||||
decoratorExpressions.push(createMetadataHelper("design:returntype", serializeReturnTypeOfNode(node)));
|
||||
decoratorExpressions.push(createMetadataHelper(currentSourceFileExternalHelpersModuleName, "design:returntype", serializeReturnTypeOfNode(node)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1499,7 +1543,7 @@ namespace ts {
|
||||
(properties || (properties = [])).push(createPropertyAssignment("returnType", createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, /*equalsGreaterThanToken*/ undefined, serializeReturnTypeOfNode(node))));
|
||||
}
|
||||
if (properties) {
|
||||
decoratorExpressions.push(createMetadataHelper("design:typeinfo", createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true)));
|
||||
decoratorExpressions.push(createMetadataHelper(currentSourceFileExternalHelpersModuleName, "design:typeinfo", createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2193,6 +2237,7 @@ namespace ts {
|
||||
statements.push(
|
||||
createReturn(
|
||||
createAwaiterHelper(
|
||||
currentSourceFileExternalHelpersModuleName,
|
||||
hasLexicalArguments,
|
||||
promiseConstructor,
|
||||
transformFunctionBodyWorker(<Block>node.body)
|
||||
@ -2219,6 +2264,7 @@ namespace ts {
|
||||
}
|
||||
else {
|
||||
return createAwaiterHelper(
|
||||
currentSourceFileExternalHelpersModuleName,
|
||||
hasLexicalArguments,
|
||||
promiseConstructor,
|
||||
<Block>transformConciseBodyWorker(node.body, /*forceBlockFunctionBody*/ true)
|
||||
|
||||
@ -390,34 +390,34 @@ namespace ts {
|
||||
|
||||
export const enum NodeFlags {
|
||||
None = 0,
|
||||
Let = 1 << 0, // Variable declaration
|
||||
Const = 1 << 1, // Variable declaration
|
||||
NestedNamespace = 1 << 2, // Namespace declaration
|
||||
Synthesized = 1 << 3, // Node was synthesized during transformation
|
||||
Namespace = 1 << 12, // Namespace declaration
|
||||
ExportContext = 1 << 13, // Export context (initialized by binding)
|
||||
ContainsThis = 1 << 14, // Interface contains references to "this"
|
||||
HasImplicitReturn = 1 << 15, // If function implicitly returns on one of codepaths (initialized by binding)
|
||||
HasExplicitReturn = 1 << 16, // If function has explicit reachable return on one of codepaths (initialized by binding)
|
||||
GlobalAugmentation = 1 << 17, // Set if module declaration is an augmentation for the global scope
|
||||
HasClassExtends = 1 << 18, // If the file has a non-ambient class with an extends clause in ES5 or lower (initialized by binding)
|
||||
HasDecorators = 1 << 19, // If the file has decorators (initialized by binding)
|
||||
HasParamDecorators = 1 << 20, // If the file has parameter decorators (initialized by binding)
|
||||
HasAsyncFunctions = 1 << 21, // If the file has async functions (initialized by binding)
|
||||
DisallowInContext = 1 << 22, // If node was parsed in a context where 'in-expressions' are not allowed
|
||||
YieldContext = 1 << 23, // If node was parsed in the 'yield' context created when parsing a generator
|
||||
DecoratorContext = 1 << 24, // If node was parsed as part of a decorator
|
||||
AwaitContext = 1 << 25, // If node was parsed in the 'await' context created when parsing an async function
|
||||
ThisNodeHasError = 1 << 26, // If the parser encountered an error when parsing the code that created this node
|
||||
JavaScriptFile = 1 << 27, // If node was parsed in a JavaScript
|
||||
ThisNodeOrAnySubNodesHasError = 1 << 28, // If this node or any of its children had an error
|
||||
HasAggregatedChildData = 1 << 29, // If we've computed data from children and cached it in this node
|
||||
HasJsxSpreadAttribute = 1 << 30,
|
||||
Let = 1 << 0, // Variable declaration
|
||||
Const = 1 << 1, // Variable declaration
|
||||
NestedNamespace = 1 << 2, // Namespace declaration
|
||||
Synthesized = 1 << 3, // Node was synthesized during transformation
|
||||
Namespace = 1 << 4, // Namespace declaration
|
||||
ExportContext = 1 << 5, // Export context (initialized by binding)
|
||||
ContainsThis = 1 << 6, // Interface contains references to "this"
|
||||
HasImplicitReturn = 1 << 7, // If function implicitly returns on one of codepaths (initialized by binding)
|
||||
HasExplicitReturn = 1 << 8, // If function has explicit reachable return on one of codepaths (initialized by binding)
|
||||
GlobalAugmentation = 1 << 9, // Set if module declaration is an augmentation for the global scope
|
||||
HasClassExtends = 1 << 10, // If the file has a non-ambient class with an extends clause in ES5 or lower (initialized by binding)
|
||||
HasDecorators = 1 << 11, // If the file has decorators (initialized by binding)
|
||||
HasParamDecorators = 1 << 12, // If the file has parameter decorators (initialized by binding)
|
||||
HasAsyncFunctions = 1 << 13, // If the file has async functions (initialized by binding)
|
||||
HasJsxSpreadAttributes = 1 << 14, // If the file as JSX spread attributes (initialized by binding)
|
||||
DisallowInContext = 1 << 15, // If node was parsed in a context where 'in-expressions' are not allowed
|
||||
YieldContext = 1 << 16, // If node was parsed in the 'yield' context created when parsing a generator
|
||||
DecoratorContext = 1 << 17, // If node was parsed as part of a decorator
|
||||
AwaitContext = 1 << 18, // If node was parsed in the 'await' context created when parsing an async function
|
||||
ThisNodeHasError = 1 << 19, // If the parser encountered an error when parsing the code that created this node
|
||||
JavaScriptFile = 1 << 20, // If node was parsed in a JavaScript
|
||||
ThisNodeOrAnySubNodesHasError = 1 << 21, // If this node or any of its children had an error
|
||||
HasAggregatedChildData = 1 << 22, // If we've computed data from children and cached it in this node
|
||||
|
||||
BlockScoped = Let | Const,
|
||||
|
||||
ReachabilityCheckFlags = HasImplicitReturn | HasExplicitReturn,
|
||||
EmitHelperFlags = HasClassExtends | HasDecorators | HasParamDecorators | HasAsyncFunctions,
|
||||
EmitHelperFlags = HasClassExtends | HasDecorators | HasParamDecorators | HasAsyncFunctions | HasJsxSpreadAttributes,
|
||||
ReachabilityAndEmitFlags = ReachabilityCheckFlags | EmitHelperFlags,
|
||||
|
||||
// Parsing context flags
|
||||
@ -1733,6 +1733,8 @@ namespace ts {
|
||||
/* @internal */ imports: LiteralExpression[];
|
||||
/* @internal */ moduleAugmentations: LiteralExpression[];
|
||||
/* @internal */ patternAmbientModules?: PatternAmbientModule[];
|
||||
// The synthesized identifier for an imported external helpers module.
|
||||
/* @internal */ externalHelpersModuleName?: Identifier;
|
||||
}
|
||||
|
||||
export interface ScriptReferenceHost {
|
||||
@ -2590,6 +2592,7 @@ namespace ts {
|
||||
experimentalDecorators?: boolean;
|
||||
forceConsistentCasingInFileNames?: boolean;
|
||||
/*@internal*/help?: boolean;
|
||||
importHelpers?: boolean;
|
||||
/*@internal*/init?: boolean;
|
||||
inlineSourceMap?: boolean;
|
||||
inlineSources?: boolean;
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||
/* @internal */
|
||||
namespace ts {
|
||||
export const externalHelpersModuleNameText = "tslib";
|
||||
|
||||
export interface ReferencePathMatchResult {
|
||||
fileReference?: FileReference;
|
||||
diagnosticMessage?: DiagnosticMessage;
|
||||
@ -117,7 +119,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function hasResolvedModule(sourceFile: SourceFile, moduleNameText: string): boolean {
|
||||
return sourceFile.resolvedModules && hasProperty(sourceFile.resolvedModules, moduleNameText);
|
||||
return sourceFile && sourceFile.resolvedModules && hasProperty(sourceFile.resolvedModules, moduleNameText);
|
||||
}
|
||||
|
||||
export function getResolvedModule(sourceFile: SourceFile, moduleNameText: string): ResolvedModule {
|
||||
|
||||
116
tests/baselines/reference/importHelpers.js
Normal file
116
tests/baselines/reference/importHelpers.js
Normal file
@ -0,0 +1,116 @@
|
||||
//// [tests/cases/compiler/importHelpers.ts] ////
|
||||
|
||||
//// [external.ts]
|
||||
export class A { }
|
||||
export class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
//// [script.ts]
|
||||
class A { }
|
||||
class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
//// [tslib.d.ts]
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
export declare function __assign(t: any, ...sources: any[]): 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;
|
||||
|
||||
|
||||
//// [external.js]
|
||||
"use strict";
|
||||
var tslib_1 = require("tslib");
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
exports.A = A;
|
||||
var B = (function (_super) {
|
||||
tslib_1.__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
}(A));
|
||||
exports.B = B;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.method = function (x) {
|
||||
};
|
||||
return C;
|
||||
}());
|
||||
tslib_1.__decorate([
|
||||
tslib_1.__param(0, dec),
|
||||
tslib_1.__metadata("design:type", Function),
|
||||
tslib_1.__metadata("design:paramtypes", [Number]),
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], C.prototype, "method", null);
|
||||
C = tslib_1.__decorate([
|
||||
dec,
|
||||
tslib_1.__metadata("design:paramtypes", [])
|
||||
], C);
|
||||
//// [script.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
}(A));
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.method = function (x) {
|
||||
};
|
||||
return C;
|
||||
}());
|
||||
__decorate([
|
||||
__param(0, dec),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [Number]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], C.prototype, "method", null);
|
||||
C = __decorate([
|
||||
dec,
|
||||
__metadata("design:paramtypes", [])
|
||||
], C);
|
||||
91
tests/baselines/reference/importHelpers.symbols
Normal file
91
tests/baselines/reference/importHelpers.symbols
Normal file
@ -0,0 +1,91 @@
|
||||
=== tests/cases/compiler/external.ts ===
|
||||
export class A { }
|
||||
>A : Symbol(A, Decl(external.ts, 0, 0))
|
||||
|
||||
export class B extends A { }
|
||||
>B : Symbol(B, Decl(external.ts, 0, 18))
|
||||
>A : Symbol(A, Decl(external.ts, 0, 0))
|
||||
|
||||
declare var dec: any;
|
||||
>dec : Symbol(dec, Decl(external.ts, 3, 11))
|
||||
|
||||
@dec
|
||||
>dec : Symbol(dec, Decl(external.ts, 3, 11))
|
||||
|
||||
class C {
|
||||
>C : Symbol(C, Decl(external.ts, 3, 21))
|
||||
|
||||
method(@dec x: number) {
|
||||
>method : Symbol(C.method, Decl(external.ts, 6, 9))
|
||||
>dec : Symbol(dec, Decl(external.ts, 3, 11))
|
||||
>x : Symbol(x, Decl(external.ts, 7, 11))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/script.ts ===
|
||||
class A { }
|
||||
>A : Symbol(A, Decl(script.ts, 0, 0))
|
||||
|
||||
class B extends A { }
|
||||
>B : Symbol(B, Decl(script.ts, 0, 11))
|
||||
>A : Symbol(A, Decl(script.ts, 0, 0))
|
||||
|
||||
declare var dec: any;
|
||||
>dec : Symbol(dec, Decl(script.ts, 3, 11))
|
||||
|
||||
@dec
|
||||
>dec : Symbol(dec, Decl(script.ts, 3, 11))
|
||||
|
||||
class C {
|
||||
>C : Symbol(C, Decl(script.ts, 3, 21))
|
||||
|
||||
method(@dec x: number) {
|
||||
>method : Symbol(C.method, Decl(script.ts, 6, 9))
|
||||
>dec : Symbol(dec, Decl(script.ts, 3, 11))
|
||||
>x : Symbol(x, Decl(script.ts, 7, 11))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/tslib.d.ts ===
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
>__extends : Symbol(__extends, Decl(tslib.d.ts, --, --))
|
||||
>d : Symbol(d, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>b : Symbol(b, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
export declare function __assign(t: any, ...sources: any[]): any;
|
||||
>__assign : Symbol(__assign, Decl(tslib.d.ts, --, --))
|
||||
>t : Symbol(t, Decl(tslib.d.ts, --, --))
|
||||
>sources : Symbol(sources, Decl(tslib.d.ts, --, --))
|
||||
|
||||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
|
||||
>__decorate : Symbol(__decorate, Decl(tslib.d.ts, --, --))
|
||||
>decorators : Symbol(decorators, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>target : Symbol(target, Decl(tslib.d.ts, --, --))
|
||||
>key : Symbol(key, Decl(tslib.d.ts, --, --))
|
||||
>desc : Symbol(desc, Decl(tslib.d.ts, --, --))
|
||||
|
||||
export declare function __param(paramIndex: number, decorator: Function): Function;
|
||||
>__param : Symbol(__param, Decl(tslib.d.ts, --, --))
|
||||
>paramIndex : Symbol(paramIndex, Decl(tslib.d.ts, --, --))
|
||||
>decorator : Symbol(decorator, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
|
||||
>__metadata : Symbol(__metadata, Decl(tslib.d.ts, --, --))
|
||||
>metadataKey : Symbol(metadataKey, Decl(tslib.d.ts, --, --))
|
||||
>metadataValue : Symbol(metadataValue, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
|
||||
>__awaiter : Symbol(__awaiter, Decl(tslib.d.ts, --, --))
|
||||
>thisArg : Symbol(thisArg, Decl(tslib.d.ts, --, --))
|
||||
>_arguments : Symbol(_arguments, Decl(tslib.d.ts, --, --))
|
||||
>P : Symbol(P, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>generator : Symbol(generator, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
91
tests/baselines/reference/importHelpers.types
Normal file
91
tests/baselines/reference/importHelpers.types
Normal file
@ -0,0 +1,91 @@
|
||||
=== tests/cases/compiler/external.ts ===
|
||||
export class A { }
|
||||
>A : A
|
||||
|
||||
export class B extends A { }
|
||||
>B : B
|
||||
>A : A
|
||||
|
||||
declare var dec: any;
|
||||
>dec : any
|
||||
|
||||
@dec
|
||||
>dec : any
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
method(@dec x: number) {
|
||||
>method : (x: number) => void
|
||||
>dec : any
|
||||
>x : number
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/script.ts ===
|
||||
class A { }
|
||||
>A : A
|
||||
|
||||
class B extends A { }
|
||||
>B : B
|
||||
>A : A
|
||||
|
||||
declare var dec: any;
|
||||
>dec : any
|
||||
|
||||
@dec
|
||||
>dec : any
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
method(@dec x: number) {
|
||||
>method : (x: number) => void
|
||||
>dec : any
|
||||
>x : number
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/tslib.d.ts ===
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
>__extends : (d: Function, b: Function) => void
|
||||
>d : Function
|
||||
>Function : Function
|
||||
>b : Function
|
||||
>Function : Function
|
||||
|
||||
export declare function __assign(t: any, ...sources: any[]): any;
|
||||
>__assign : (t: any, ...sources: any[]) => any
|
||||
>t : any
|
||||
>sources : any[]
|
||||
|
||||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
|
||||
>__decorate : (decorators: Function[], target: any, key?: string | symbol, desc?: any) => any
|
||||
>decorators : Function[]
|
||||
>Function : Function
|
||||
>target : any
|
||||
>key : string | symbol
|
||||
>desc : any
|
||||
|
||||
export declare function __param(paramIndex: number, decorator: Function): Function;
|
||||
>__param : (paramIndex: number, decorator: Function) => Function
|
||||
>paramIndex : number
|
||||
>decorator : Function
|
||||
>Function : Function
|
||||
>Function : Function
|
||||
|
||||
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
|
||||
>__metadata : (metadataKey: any, metadataValue: any) => Function
|
||||
>metadataKey : any
|
||||
>metadataValue : any
|
||||
>Function : Function
|
||||
|
||||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
|
||||
>__awaiter : (thisArg: any, _arguments: any, P: Function, generator: Function) => any
|
||||
>thisArg : any
|
||||
>_arguments : any
|
||||
>P : Function
|
||||
>Function : Function
|
||||
>generator : Function
|
||||
>Function : Function
|
||||
|
||||
40
tests/baselines/reference/importHelpersAmd.js
Normal file
40
tests/baselines/reference/importHelpersAmd.js
Normal file
@ -0,0 +1,40 @@
|
||||
//// [tests/cases/compiler/importHelpersAmd.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
export class A { }
|
||||
|
||||
//// [b.ts]
|
||||
import { A } from "./a";
|
||||
export class B extends A { }
|
||||
|
||||
//// [tslib.d.ts]
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
export declare function __assign(t: any, ...sources: any[]): 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;
|
||||
|
||||
|
||||
//// [a.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
exports.A = A;
|
||||
});
|
||||
//// [b.js]
|
||||
define(["require", "exports", "tslib", "./a"], function (require, exports, tslib_1, a_1) {
|
||||
"use strict";
|
||||
var B = (function (_super) {
|
||||
tslib_1.__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
}(a_1.A));
|
||||
exports.B = B;
|
||||
});
|
||||
55
tests/baselines/reference/importHelpersAmd.symbols
Normal file
55
tests/baselines/reference/importHelpersAmd.symbols
Normal file
@ -0,0 +1,55 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
export class A { }
|
||||
>A : Symbol(A, Decl(a.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import { A } from "./a";
|
||||
>A : Symbol(A, Decl(b.ts, 0, 8))
|
||||
|
||||
export class B extends A { }
|
||||
>B : Symbol(B, Decl(b.ts, 0, 24))
|
||||
>A : Symbol(A, Decl(b.ts, 0, 8))
|
||||
|
||||
=== tests/cases/compiler/tslib.d.ts ===
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
>__extends : Symbol(__extends, Decl(tslib.d.ts, --, --))
|
||||
>d : Symbol(d, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>b : Symbol(b, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
export declare function __assign(t: any, ...sources: any[]): any;
|
||||
>__assign : Symbol(__assign, Decl(tslib.d.ts, --, --))
|
||||
>t : Symbol(t, Decl(tslib.d.ts, --, --))
|
||||
>sources : Symbol(sources, Decl(tslib.d.ts, --, --))
|
||||
|
||||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
|
||||
>__decorate : Symbol(__decorate, Decl(tslib.d.ts, --, --))
|
||||
>decorators : Symbol(decorators, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>target : Symbol(target, Decl(tslib.d.ts, --, --))
|
||||
>key : Symbol(key, Decl(tslib.d.ts, --, --))
|
||||
>desc : Symbol(desc, Decl(tslib.d.ts, --, --))
|
||||
|
||||
export declare function __param(paramIndex: number, decorator: Function): Function;
|
||||
>__param : Symbol(__param, Decl(tslib.d.ts, --, --))
|
||||
>paramIndex : Symbol(paramIndex, Decl(tslib.d.ts, --, --))
|
||||
>decorator : Symbol(decorator, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
|
||||
>__metadata : Symbol(__metadata, Decl(tslib.d.ts, --, --))
|
||||
>metadataKey : Symbol(metadataKey, Decl(tslib.d.ts, --, --))
|
||||
>metadataValue : Symbol(metadataValue, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
|
||||
>__awaiter : Symbol(__awaiter, Decl(tslib.d.ts, --, --))
|
||||
>thisArg : Symbol(thisArg, Decl(tslib.d.ts, --, --))
|
||||
>_arguments : Symbol(_arguments, Decl(tslib.d.ts, --, --))
|
||||
>P : Symbol(P, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>generator : Symbol(generator, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
55
tests/baselines/reference/importHelpersAmd.types
Normal file
55
tests/baselines/reference/importHelpersAmd.types
Normal file
@ -0,0 +1,55 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
export class A { }
|
||||
>A : A
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import { A } from "./a";
|
||||
>A : typeof A
|
||||
|
||||
export class B extends A { }
|
||||
>B : B
|
||||
>A : A
|
||||
|
||||
=== tests/cases/compiler/tslib.d.ts ===
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
>__extends : (d: Function, b: Function) => void
|
||||
>d : Function
|
||||
>Function : Function
|
||||
>b : Function
|
||||
>Function : Function
|
||||
|
||||
export declare function __assign(t: any, ...sources: any[]): any;
|
||||
>__assign : (t: any, ...sources: any[]) => any
|
||||
>t : any
|
||||
>sources : any[]
|
||||
|
||||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
|
||||
>__decorate : (decorators: Function[], target: any, key?: string | symbol, desc?: any) => any
|
||||
>decorators : Function[]
|
||||
>Function : Function
|
||||
>target : any
|
||||
>key : string | symbol
|
||||
>desc : any
|
||||
|
||||
export declare function __param(paramIndex: number, decorator: Function): Function;
|
||||
>__param : (paramIndex: number, decorator: Function) => Function
|
||||
>paramIndex : number
|
||||
>decorator : Function
|
||||
>Function : Function
|
||||
>Function : Function
|
||||
|
||||
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
|
||||
>__metadata : (metadataKey: any, metadataValue: any) => Function
|
||||
>metadataKey : any
|
||||
>metadataValue : any
|
||||
>Function : Function
|
||||
|
||||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
|
||||
>__awaiter : (thisArg: any, _arguments: any, P: Function, generator: Function) => any
|
||||
>thisArg : any
|
||||
>_arguments : any
|
||||
>P : Function
|
||||
>Function : Function
|
||||
>generator : Function
|
||||
>Function : Function
|
||||
|
||||
25
tests/baselines/reference/importHelpersES6.js
Normal file
25
tests/baselines/reference/importHelpersES6.js
Normal file
@ -0,0 +1,25 @@
|
||||
//// [tests/cases/compiler/importHelpersES6.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
declare var dec: any;
|
||||
@dec export class A {
|
||||
|
||||
}
|
||||
|
||||
//// [tslib.d.ts]
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
export declare function __assign(t: any, ...sources: any[]): 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;
|
||||
|
||||
|
||||
//// [a.js]
|
||||
import * as tslib_1 from "tslib";
|
||||
let A = class A {
|
||||
};
|
||||
A = tslib_1.__decorate([
|
||||
dec
|
||||
], A);
|
||||
export { A };
|
||||
53
tests/baselines/reference/importHelpersES6.symbols
Normal file
53
tests/baselines/reference/importHelpersES6.symbols
Normal file
@ -0,0 +1,53 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
declare var dec: any;
|
||||
>dec : Symbol(dec, Decl(a.ts, 0, 11))
|
||||
|
||||
@dec export class A {
|
||||
>dec : Symbol(dec, Decl(a.ts, 0, 11))
|
||||
>A : Symbol(A, Decl(a.ts, 0, 21))
|
||||
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/tslib.d.ts ===
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
>__extends : Symbol(__extends, Decl(tslib.d.ts, --, --))
|
||||
>d : Symbol(d, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
|
||||
>b : Symbol(b, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
|
||||
|
||||
export declare function __assign(t: any, ...sources: any[]): any;
|
||||
>__assign : Symbol(__assign, Decl(tslib.d.ts, --, --))
|
||||
>t : Symbol(t, Decl(tslib.d.ts, --, --))
|
||||
>sources : Symbol(sources, Decl(tslib.d.ts, --, --))
|
||||
|
||||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
|
||||
>__decorate : Symbol(__decorate, Decl(tslib.d.ts, --, --))
|
||||
>decorators : Symbol(decorators, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
|
||||
>target : Symbol(target, Decl(tslib.d.ts, --, --))
|
||||
>key : Symbol(key, Decl(tslib.d.ts, --, --))
|
||||
>desc : Symbol(desc, Decl(tslib.d.ts, --, --))
|
||||
|
||||
export declare function __param(paramIndex: number, decorator: Function): Function;
|
||||
>__param : Symbol(__param, Decl(tslib.d.ts, --, --))
|
||||
>paramIndex : Symbol(paramIndex, Decl(tslib.d.ts, --, --))
|
||||
>decorator : Symbol(decorator, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
|
||||
|
||||
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
|
||||
>__metadata : Symbol(__metadata, Decl(tslib.d.ts, --, --))
|
||||
>metadataKey : Symbol(metadataKey, Decl(tslib.d.ts, --, --))
|
||||
>metadataValue : Symbol(metadataValue, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
|
||||
|
||||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
|
||||
>__awaiter : Symbol(__awaiter, Decl(tslib.d.ts, --, --))
|
||||
>thisArg : Symbol(thisArg, Decl(tslib.d.ts, --, --))
|
||||
>_arguments : Symbol(_arguments, Decl(tslib.d.ts, --, --))
|
||||
>P : Symbol(P, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
|
||||
>generator : Symbol(generator, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
|
||||
|
||||
53
tests/baselines/reference/importHelpersES6.types
Normal file
53
tests/baselines/reference/importHelpersES6.types
Normal file
@ -0,0 +1,53 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
declare var dec: any;
|
||||
>dec : any
|
||||
|
||||
@dec export class A {
|
||||
>dec : any
|
||||
>A : A
|
||||
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/tslib.d.ts ===
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
>__extends : (d: Function, b: Function) => void
|
||||
>d : Function
|
||||
>Function : Function
|
||||
>b : Function
|
||||
>Function : Function
|
||||
|
||||
export declare function __assign(t: any, ...sources: any[]): any;
|
||||
>__assign : (t: any, ...sources: any[]) => any
|
||||
>t : any
|
||||
>sources : any[]
|
||||
|
||||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
|
||||
>__decorate : (decorators: Function[], target: any, key?: string | symbol, desc?: any) => any
|
||||
>decorators : Function[]
|
||||
>Function : Function
|
||||
>target : any
|
||||
>key : string | symbol
|
||||
>desc : any
|
||||
|
||||
export declare function __param(paramIndex: number, decorator: Function): Function;
|
||||
>__param : (paramIndex: number, decorator: Function) => Function
|
||||
>paramIndex : number
|
||||
>decorator : Function
|
||||
>Function : Function
|
||||
>Function : Function
|
||||
|
||||
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
|
||||
>__metadata : (metadataKey: any, metadataValue: any) => Function
|
||||
>metadataKey : any
|
||||
>metadataValue : any
|
||||
>Function : Function
|
||||
|
||||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
|
||||
>__awaiter : (thisArg: any, _arguments: any, P: Function, generator: Function) => any
|
||||
>thisArg : any
|
||||
>_arguments : any
|
||||
>P : Function
|
||||
>Function : Function
|
||||
>generator : Function
|
||||
>Function : Function
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
tests/cases/compiler/script.ts(1,1): error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided.
|
||||
|
||||
|
||||
==== tests/cases/compiler/external.ts (0 errors) ====
|
||||
export class A { }
|
||||
export class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/script.ts (1 errors) ====
|
||||
class A { }
|
||||
~~~~~
|
||||
!!! error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided.
|
||||
class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/tslib.d.ts (0 errors) ====
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
export declare function __assign(t: any, ...sources: any[]): 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;
|
||||
|
||||
101
tests/baselines/reference/importHelpersInIsolatedModules.js
Normal file
101
tests/baselines/reference/importHelpersInIsolatedModules.js
Normal file
@ -0,0 +1,101 @@
|
||||
//// [tests/cases/compiler/importHelpersInIsolatedModules.ts] ////
|
||||
|
||||
//// [external.ts]
|
||||
export class A { }
|
||||
export class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
//// [script.ts]
|
||||
class A { }
|
||||
class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
//// [tslib.d.ts]
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
export declare function __assign(t: any, ...sources: any[]): 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;
|
||||
|
||||
|
||||
//// [external.js]
|
||||
"use strict";
|
||||
var tslib_1 = require("tslib");
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
exports.A = A;
|
||||
var B = (function (_super) {
|
||||
tslib_1.__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
}(A));
|
||||
exports.B = B;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.method = function (x) {
|
||||
};
|
||||
return C;
|
||||
}());
|
||||
tslib_1.__decorate([
|
||||
tslib_1.__param(0, dec),
|
||||
tslib_1.__metadata("design:type", Function),
|
||||
tslib_1.__metadata("design:paramtypes", [Number]),
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], C.prototype, "method", null);
|
||||
C = tslib_1.__decorate([
|
||||
dec,
|
||||
tslib_1.__metadata("design:paramtypes", [])
|
||||
], C);
|
||||
//// [script.js]
|
||||
"use strict";
|
||||
var tslib_1 = require("tslib");
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
var B = (function (_super) {
|
||||
tslib_1.__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
}(A));
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.method = function (x) {
|
||||
};
|
||||
return C;
|
||||
}());
|
||||
tslib_1.__decorate([
|
||||
tslib_1.__param(0, dec),
|
||||
tslib_1.__metadata("design:type", Function),
|
||||
tslib_1.__metadata("design:paramtypes", [Number]),
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], C.prototype, "method", null);
|
||||
C = tslib_1.__decorate([
|
||||
dec,
|
||||
tslib_1.__metadata("design:paramtypes", [])
|
||||
], C);
|
||||
35
tests/baselines/reference/importHelpersInTsx.js
Normal file
35
tests/baselines/reference/importHelpersInTsx.js
Normal file
@ -0,0 +1,35 @@
|
||||
//// [tests/cases/compiler/importHelpersInTsx.tsx] ////
|
||||
|
||||
//// [external.tsx]
|
||||
declare var React: any;
|
||||
declare var o: any;
|
||||
export const x = <span {...o} />
|
||||
|
||||
//// [script.tsx]
|
||||
declare var React: any;
|
||||
declare var o: any;
|
||||
const x = <span {...o} />
|
||||
|
||||
//// [tslib.d.ts]
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
export declare function __assign(t: any, ...sources: any[]): 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;
|
||||
|
||||
|
||||
//// [external.js]
|
||||
"use strict";
|
||||
var tslib_1 = require("tslib");
|
||||
exports.x = React.createElement("span", tslib_1.__assign({}, o));
|
||||
//// [script.js]
|
||||
var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
var x = React.createElement("span", __assign({}, o));
|
||||
67
tests/baselines/reference/importHelpersInTsx.symbols
Normal file
67
tests/baselines/reference/importHelpersInTsx.symbols
Normal file
@ -0,0 +1,67 @@
|
||||
=== tests/cases/compiler/external.tsx ===
|
||||
declare var React: any;
|
||||
>React : Symbol(React, Decl(external.tsx, 0, 11))
|
||||
|
||||
declare var o: any;
|
||||
>o : Symbol(o, Decl(external.tsx, 1, 11))
|
||||
|
||||
export const x = <span {...o} />
|
||||
>x : Symbol(x, Decl(external.tsx, 2, 12))
|
||||
>span : Symbol(unknown)
|
||||
>o : Symbol(o, Decl(external.tsx, 1, 11))
|
||||
|
||||
=== tests/cases/compiler/script.tsx ===
|
||||
declare var React: any;
|
||||
>React : Symbol(React, Decl(script.tsx, 0, 11))
|
||||
|
||||
declare var o: any;
|
||||
>o : Symbol(o, Decl(script.tsx, 1, 11))
|
||||
|
||||
const x = <span {...o} />
|
||||
>x : Symbol(x, Decl(script.tsx, 2, 5))
|
||||
>span : Symbol(unknown)
|
||||
>o : Symbol(o, Decl(script.tsx, 1, 11))
|
||||
|
||||
=== tests/cases/compiler/tslib.d.ts ===
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
>__extends : Symbol(__extends, Decl(tslib.d.ts, --, --))
|
||||
>d : Symbol(d, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>b : Symbol(b, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
export declare function __assign(t: any, ...sources: any[]): any;
|
||||
>__assign : Symbol(__assign, Decl(tslib.d.ts, --, --))
|
||||
>t : Symbol(t, Decl(tslib.d.ts, --, --))
|
||||
>sources : Symbol(sources, Decl(tslib.d.ts, --, --))
|
||||
|
||||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
|
||||
>__decorate : Symbol(__decorate, Decl(tslib.d.ts, --, --))
|
||||
>decorators : Symbol(decorators, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>target : Symbol(target, Decl(tslib.d.ts, --, --))
|
||||
>key : Symbol(key, Decl(tslib.d.ts, --, --))
|
||||
>desc : Symbol(desc, Decl(tslib.d.ts, --, --))
|
||||
|
||||
export declare function __param(paramIndex: number, decorator: Function): Function;
|
||||
>__param : Symbol(__param, Decl(tslib.d.ts, --, --))
|
||||
>paramIndex : Symbol(paramIndex, Decl(tslib.d.ts, --, --))
|
||||
>decorator : Symbol(decorator, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
|
||||
>__metadata : Symbol(__metadata, Decl(tslib.d.ts, --, --))
|
||||
>metadataKey : Symbol(metadataKey, Decl(tslib.d.ts, --, --))
|
||||
>metadataValue : Symbol(metadataValue, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
|
||||
>__awaiter : Symbol(__awaiter, Decl(tslib.d.ts, --, --))
|
||||
>thisArg : Symbol(thisArg, Decl(tslib.d.ts, --, --))
|
||||
>_arguments : Symbol(_arguments, Decl(tslib.d.ts, --, --))
|
||||
>P : Symbol(P, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>generator : Symbol(generator, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
69
tests/baselines/reference/importHelpersInTsx.types
Normal file
69
tests/baselines/reference/importHelpersInTsx.types
Normal file
@ -0,0 +1,69 @@
|
||||
=== tests/cases/compiler/external.tsx ===
|
||||
declare var React: any;
|
||||
>React : any
|
||||
|
||||
declare var o: any;
|
||||
>o : any
|
||||
|
||||
export const x = <span {...o} />
|
||||
>x : any
|
||||
><span {...o} /> : any
|
||||
>span : any
|
||||
>o : any
|
||||
|
||||
=== tests/cases/compiler/script.tsx ===
|
||||
declare var React: any;
|
||||
>React : any
|
||||
|
||||
declare var o: any;
|
||||
>o : any
|
||||
|
||||
const x = <span {...o} />
|
||||
>x : any
|
||||
><span {...o} /> : any
|
||||
>span : any
|
||||
>o : any
|
||||
|
||||
=== tests/cases/compiler/tslib.d.ts ===
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
>__extends : (d: Function, b: Function) => void
|
||||
>d : Function
|
||||
>Function : Function
|
||||
>b : Function
|
||||
>Function : Function
|
||||
|
||||
export declare function __assign(t: any, ...sources: any[]): any;
|
||||
>__assign : (t: any, ...sources: any[]) => any
|
||||
>t : any
|
||||
>sources : any[]
|
||||
|
||||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
|
||||
>__decorate : (decorators: Function[], target: any, key?: string | symbol, desc?: any) => any
|
||||
>decorators : Function[]
|
||||
>Function : Function
|
||||
>target : any
|
||||
>key : string | symbol
|
||||
>desc : any
|
||||
|
||||
export declare function __param(paramIndex: number, decorator: Function): Function;
|
||||
>__param : (paramIndex: number, decorator: Function) => Function
|
||||
>paramIndex : number
|
||||
>decorator : Function
|
||||
>Function : Function
|
||||
>Function : Function
|
||||
|
||||
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
|
||||
>__metadata : (metadataKey: any, metadataValue: any) => Function
|
||||
>metadataKey : any
|
||||
>metadataValue : any
|
||||
>Function : Function
|
||||
|
||||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
|
||||
>__awaiter : (thisArg: any, _arguments: any, P: Function, generator: Function) => any
|
||||
>thisArg : any
|
||||
>_arguments : any
|
||||
>P : Function
|
||||
>Function : Function
|
||||
>generator : Function
|
||||
>Function : Function
|
||||
|
||||
36
tests/baselines/reference/importHelpersNoHelpers.errors.txt
Normal file
36
tests/baselines/reference/importHelpersNoHelpers.errors.txt
Normal file
@ -0,0 +1,36 @@
|
||||
error TS2305: Module 'tslib' has no exported member '__decorate'.
|
||||
error TS2305: Module 'tslib' has no exported member '__extends'.
|
||||
error TS2305: Module 'tslib' has no exported member '__metadata'.
|
||||
error TS2305: Module 'tslib' has no exported member '__param'.
|
||||
|
||||
|
||||
!!! error TS2305: Module 'tslib' has no exported member '__decorate'.
|
||||
!!! error TS2305: Module 'tslib' has no exported member '__extends'.
|
||||
!!! error TS2305: Module 'tslib' has no exported member '__metadata'.
|
||||
!!! error TS2305: Module 'tslib' has no exported member '__param'.
|
||||
==== tests/cases/compiler/external.ts (0 errors) ====
|
||||
export class A { }
|
||||
export class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/script.ts (0 errors) ====
|
||||
class A { }
|
||||
class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/tslib.d.ts (0 errors) ====
|
||||
export {}
|
||||
110
tests/baselines/reference/importHelpersNoHelpers.js
Normal file
110
tests/baselines/reference/importHelpersNoHelpers.js
Normal file
@ -0,0 +1,110 @@
|
||||
//// [tests/cases/compiler/importHelpersNoHelpers.ts] ////
|
||||
|
||||
//// [external.ts]
|
||||
export class A { }
|
||||
export class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
//// [script.ts]
|
||||
class A { }
|
||||
class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
//// [tslib.d.ts]
|
||||
export {}
|
||||
|
||||
//// [external.js]
|
||||
"use strict";
|
||||
var tslib_1 = require("tslib");
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
exports.A = A;
|
||||
var B = (function (_super) {
|
||||
tslib_1.__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
}(A));
|
||||
exports.B = B;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.method = function (x) {
|
||||
};
|
||||
return C;
|
||||
}());
|
||||
tslib_1.__decorate([
|
||||
tslib_1.__param(0, dec),
|
||||
tslib_1.__metadata("design:type", Function),
|
||||
tslib_1.__metadata("design:paramtypes", [Number]),
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], C.prototype, "method", null);
|
||||
C = tslib_1.__decorate([
|
||||
dec,
|
||||
tslib_1.__metadata("design:paramtypes", [])
|
||||
], C);
|
||||
//// [script.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
}(A));
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.method = function (x) {
|
||||
};
|
||||
return C;
|
||||
}());
|
||||
__decorate([
|
||||
__param(0, dec),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [Number]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], C.prototype, "method", null);
|
||||
C = __decorate([
|
||||
dec,
|
||||
__metadata("design:paramtypes", [])
|
||||
], C);
|
||||
28
tests/baselines/reference/importHelpersNoModule.errors.txt
Normal file
28
tests/baselines/reference/importHelpersNoModule.errors.txt
Normal file
@ -0,0 +1,28 @@
|
||||
error TS2307: Cannot find module 'tslib'.
|
||||
|
||||
|
||||
!!! error TS2307: Cannot find module 'tslib'.
|
||||
==== tests/cases/compiler/external.ts (0 errors) ====
|
||||
export class A { }
|
||||
export class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/script.ts (0 errors) ====
|
||||
class A { }
|
||||
class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
108
tests/baselines/reference/importHelpersNoModule.js
Normal file
108
tests/baselines/reference/importHelpersNoModule.js
Normal file
@ -0,0 +1,108 @@
|
||||
//// [tests/cases/compiler/importHelpersNoModule.ts] ////
|
||||
|
||||
//// [external.ts]
|
||||
export class A { }
|
||||
export class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
//// [script.ts]
|
||||
class A { }
|
||||
class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [external.js]
|
||||
"use strict";
|
||||
var tslib_1 = require("tslib");
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
exports.A = A;
|
||||
var B = (function (_super) {
|
||||
tslib_1.__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
}(A));
|
||||
exports.B = B;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.method = function (x) {
|
||||
};
|
||||
return C;
|
||||
}());
|
||||
tslib_1.__decorate([
|
||||
tslib_1.__param(0, dec),
|
||||
tslib_1.__metadata("design:type", Function),
|
||||
tslib_1.__metadata("design:paramtypes", [Number]),
|
||||
tslib_1.__metadata("design:returntype", void 0)
|
||||
], C.prototype, "method", null);
|
||||
C = tslib_1.__decorate([
|
||||
dec,
|
||||
tslib_1.__metadata("design:paramtypes", [])
|
||||
], C);
|
||||
//// [script.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
}(A));
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.method = function (x) {
|
||||
};
|
||||
return C;
|
||||
}());
|
||||
__decorate([
|
||||
__param(0, dec),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [Number]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], C.prototype, "method", null);
|
||||
C = __decorate([
|
||||
dec,
|
||||
__metadata("design:paramtypes", [])
|
||||
], C);
|
||||
54
tests/baselines/reference/importHelpersOutFile.js
Normal file
54
tests/baselines/reference/importHelpersOutFile.js
Normal file
@ -0,0 +1,54 @@
|
||||
//// [tests/cases/compiler/importHelpersOutFile.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
export class A { }
|
||||
|
||||
//// [b.ts]
|
||||
import { A } from "./a";
|
||||
export class B extends A { }
|
||||
|
||||
//// [c.ts]
|
||||
import { A } from "./a";
|
||||
export class C extends A { }
|
||||
|
||||
//// [tslib.d.ts]
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
export declare function __assign(t: any, ...sources: any[]): 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;
|
||||
|
||||
|
||||
//// [out.js]
|
||||
define("a", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
exports.A = A;
|
||||
});
|
||||
define("b", ["require", "exports", "tslib", "a"], function (require, exports, tslib_1, a_1) {
|
||||
"use strict";
|
||||
var B = (function (_super) {
|
||||
tslib_1.__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
}(a_1.A));
|
||||
exports.B = B;
|
||||
});
|
||||
define("c", ["require", "exports", "tslib", "a"], function (require, exports, tslib_2, a_2) {
|
||||
"use strict";
|
||||
var C = (function (_super) {
|
||||
tslib_2.__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return C;
|
||||
}(a_2.A));
|
||||
exports.C = C;
|
||||
});
|
||||
63
tests/baselines/reference/importHelpersOutFile.symbols
Normal file
63
tests/baselines/reference/importHelpersOutFile.symbols
Normal file
@ -0,0 +1,63 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
export class A { }
|
||||
>A : Symbol(A, Decl(a.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import { A } from "./a";
|
||||
>A : Symbol(A, Decl(b.ts, 0, 8))
|
||||
|
||||
export class B extends A { }
|
||||
>B : Symbol(B, Decl(b.ts, 0, 24))
|
||||
>A : Symbol(A, Decl(b.ts, 0, 8))
|
||||
|
||||
=== tests/cases/compiler/c.ts ===
|
||||
import { A } from "./a";
|
||||
>A : Symbol(A, Decl(c.ts, 0, 8))
|
||||
|
||||
export class C extends A { }
|
||||
>C : Symbol(C, Decl(c.ts, 0, 24))
|
||||
>A : Symbol(A, Decl(c.ts, 0, 8))
|
||||
|
||||
=== tests/cases/compiler/tslib.d.ts ===
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
>__extends : Symbol(__extends, Decl(tslib.d.ts, --, --))
|
||||
>d : Symbol(d, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>b : Symbol(b, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
export declare function __assign(t: any, ...sources: any[]): any;
|
||||
>__assign : Symbol(__assign, Decl(tslib.d.ts, --, --))
|
||||
>t : Symbol(t, Decl(tslib.d.ts, --, --))
|
||||
>sources : Symbol(sources, Decl(tslib.d.ts, --, --))
|
||||
|
||||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
|
||||
>__decorate : Symbol(__decorate, Decl(tslib.d.ts, --, --))
|
||||
>decorators : Symbol(decorators, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>target : Symbol(target, Decl(tslib.d.ts, --, --))
|
||||
>key : Symbol(key, Decl(tslib.d.ts, --, --))
|
||||
>desc : Symbol(desc, Decl(tslib.d.ts, --, --))
|
||||
|
||||
export declare function __param(paramIndex: number, decorator: Function): Function;
|
||||
>__param : Symbol(__param, Decl(tslib.d.ts, --, --))
|
||||
>paramIndex : Symbol(paramIndex, Decl(tslib.d.ts, --, --))
|
||||
>decorator : Symbol(decorator, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
|
||||
>__metadata : Symbol(__metadata, Decl(tslib.d.ts, --, --))
|
||||
>metadataKey : Symbol(metadataKey, Decl(tslib.d.ts, --, --))
|
||||
>metadataValue : Symbol(metadataValue, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
|
||||
>__awaiter : Symbol(__awaiter, Decl(tslib.d.ts, --, --))
|
||||
>thisArg : Symbol(thisArg, Decl(tslib.d.ts, --, --))
|
||||
>_arguments : Symbol(_arguments, Decl(tslib.d.ts, --, --))
|
||||
>P : Symbol(P, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>generator : Symbol(generator, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
63
tests/baselines/reference/importHelpersOutFile.types
Normal file
63
tests/baselines/reference/importHelpersOutFile.types
Normal file
@ -0,0 +1,63 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
export class A { }
|
||||
>A : A
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import { A } from "./a";
|
||||
>A : typeof A
|
||||
|
||||
export class B extends A { }
|
||||
>B : B
|
||||
>A : A
|
||||
|
||||
=== tests/cases/compiler/c.ts ===
|
||||
import { A } from "./a";
|
||||
>A : typeof A
|
||||
|
||||
export class C extends A { }
|
||||
>C : C
|
||||
>A : A
|
||||
|
||||
=== tests/cases/compiler/tslib.d.ts ===
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
>__extends : (d: Function, b: Function) => void
|
||||
>d : Function
|
||||
>Function : Function
|
||||
>b : Function
|
||||
>Function : Function
|
||||
|
||||
export declare function __assign(t: any, ...sources: any[]): any;
|
||||
>__assign : (t: any, ...sources: any[]) => any
|
||||
>t : any
|
||||
>sources : any[]
|
||||
|
||||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
|
||||
>__decorate : (decorators: Function[], target: any, key?: string | symbol, desc?: any) => any
|
||||
>decorators : Function[]
|
||||
>Function : Function
|
||||
>target : any
|
||||
>key : string | symbol
|
||||
>desc : any
|
||||
|
||||
export declare function __param(paramIndex: number, decorator: Function): Function;
|
||||
>__param : (paramIndex: number, decorator: Function) => Function
|
||||
>paramIndex : number
|
||||
>decorator : Function
|
||||
>Function : Function
|
||||
>Function : Function
|
||||
|
||||
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
|
||||
>__metadata : (metadataKey: any, metadataValue: any) => Function
|
||||
>metadataKey : any
|
||||
>metadataValue : any
|
||||
>Function : Function
|
||||
|
||||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
|
||||
>__awaiter : (thisArg: any, _arguments: any, P: Function, generator: Function) => any
|
||||
>thisArg : any
|
||||
>_arguments : any
|
||||
>P : Function
|
||||
>Function : Function
|
||||
>generator : Function
|
||||
>Function : Function
|
||||
|
||||
61
tests/baselines/reference/importHelpersSystem.js
Normal file
61
tests/baselines/reference/importHelpersSystem.js
Normal file
@ -0,0 +1,61 @@
|
||||
//// [tests/cases/compiler/importHelpersSystem.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
export class A { }
|
||||
|
||||
//// [b.ts]
|
||||
import { A } from "./a";
|
||||
export class B extends A { }
|
||||
|
||||
//// [tslib.d.ts]
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
export declare function __assign(t: any, ...sources: any[]): 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;
|
||||
|
||||
|
||||
//// [a.js]
|
||||
System.register([], function (exports_1, context_1) {
|
||||
"use strict";
|
||||
var __moduleName = context_1 && context_1.id;
|
||||
var A;
|
||||
return {
|
||||
setters: [],
|
||||
execute: function () {
|
||||
A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
exports_1("A", A);
|
||||
}
|
||||
};
|
||||
});
|
||||
//// [b.js]
|
||||
System.register(["tslib", "./a"], function (exports_1, context_1) {
|
||||
"use strict";
|
||||
var __moduleName = context_1 && context_1.id;
|
||||
var tslib_1, a_1, B;
|
||||
return {
|
||||
setters: [
|
||||
function (tslib_1_1) {
|
||||
tslib_1 = tslib_1_1;
|
||||
},
|
||||
function (a_1_1) {
|
||||
a_1 = a_1_1;
|
||||
}
|
||||
],
|
||||
execute: function () {
|
||||
B = (function (_super) {
|
||||
tslib_1.__extends(B, _super);
|
||||
function B() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return B;
|
||||
}(a_1.A));
|
||||
exports_1("B", B);
|
||||
}
|
||||
};
|
||||
});
|
||||
55
tests/baselines/reference/importHelpersSystem.symbols
Normal file
55
tests/baselines/reference/importHelpersSystem.symbols
Normal file
@ -0,0 +1,55 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
export class A { }
|
||||
>A : Symbol(A, Decl(a.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import { A } from "./a";
|
||||
>A : Symbol(A, Decl(b.ts, 0, 8))
|
||||
|
||||
export class B extends A { }
|
||||
>B : Symbol(B, Decl(b.ts, 0, 24))
|
||||
>A : Symbol(A, Decl(b.ts, 0, 8))
|
||||
|
||||
=== tests/cases/compiler/tslib.d.ts ===
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
>__extends : Symbol(__extends, Decl(tslib.d.ts, --, --))
|
||||
>d : Symbol(d, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>b : Symbol(b, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
export declare function __assign(t: any, ...sources: any[]): any;
|
||||
>__assign : Symbol(__assign, Decl(tslib.d.ts, --, --))
|
||||
>t : Symbol(t, Decl(tslib.d.ts, --, --))
|
||||
>sources : Symbol(sources, Decl(tslib.d.ts, --, --))
|
||||
|
||||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
|
||||
>__decorate : Symbol(__decorate, Decl(tslib.d.ts, --, --))
|
||||
>decorators : Symbol(decorators, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>target : Symbol(target, Decl(tslib.d.ts, --, --))
|
||||
>key : Symbol(key, Decl(tslib.d.ts, --, --))
|
||||
>desc : Symbol(desc, Decl(tslib.d.ts, --, --))
|
||||
|
||||
export declare function __param(paramIndex: number, decorator: Function): Function;
|
||||
>__param : Symbol(__param, Decl(tslib.d.ts, --, --))
|
||||
>paramIndex : Symbol(paramIndex, Decl(tslib.d.ts, --, --))
|
||||
>decorator : Symbol(decorator, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
|
||||
>__metadata : Symbol(__metadata, Decl(tslib.d.ts, --, --))
|
||||
>metadataKey : Symbol(metadataKey, Decl(tslib.d.ts, --, --))
|
||||
>metadataValue : Symbol(metadataValue, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
|
||||
>__awaiter : Symbol(__awaiter, Decl(tslib.d.ts, --, --))
|
||||
>thisArg : Symbol(thisArg, Decl(tslib.d.ts, --, --))
|
||||
>_arguments : Symbol(_arguments, Decl(tslib.d.ts, --, --))
|
||||
>P : Symbol(P, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>generator : Symbol(generator, Decl(tslib.d.ts, --, --))
|
||||
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
55
tests/baselines/reference/importHelpersSystem.types
Normal file
55
tests/baselines/reference/importHelpersSystem.types
Normal file
@ -0,0 +1,55 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
export class A { }
|
||||
>A : A
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import { A } from "./a";
|
||||
>A : typeof A
|
||||
|
||||
export class B extends A { }
|
||||
>B : B
|
||||
>A : A
|
||||
|
||||
=== tests/cases/compiler/tslib.d.ts ===
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
>__extends : (d: Function, b: Function) => void
|
||||
>d : Function
|
||||
>Function : Function
|
||||
>b : Function
|
||||
>Function : Function
|
||||
|
||||
export declare function __assign(t: any, ...sources: any[]): any;
|
||||
>__assign : (t: any, ...sources: any[]) => any
|
||||
>t : any
|
||||
>sources : any[]
|
||||
|
||||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
|
||||
>__decorate : (decorators: Function[], target: any, key?: string | symbol, desc?: any) => any
|
||||
>decorators : Function[]
|
||||
>Function : Function
|
||||
>target : any
|
||||
>key : string | symbol
|
||||
>desc : any
|
||||
|
||||
export declare function __param(paramIndex: number, decorator: Function): Function;
|
||||
>__param : (paramIndex: number, decorator: Function) => Function
|
||||
>paramIndex : number
|
||||
>decorator : Function
|
||||
>Function : Function
|
||||
>Function : Function
|
||||
|
||||
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
|
||||
>__metadata : (metadataKey: any, metadataValue: any) => Function
|
||||
>metadataKey : any
|
||||
>metadataValue : any
|
||||
>Function : Function
|
||||
|
||||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
|
||||
>__awaiter : (thisArg: any, _arguments: any, P: Function, generator: Function) => any
|
||||
>thisArg : any
|
||||
>_arguments : any
|
||||
>P : Function
|
||||
>Function : Function
|
||||
>generator : Function
|
||||
>Function : Function
|
||||
|
||||
37
tests/cases/compiler/importHelpers.ts
Normal file
37
tests/cases/compiler/importHelpers.ts
Normal file
@ -0,0 +1,37 @@
|
||||
// @importHelpers: true
|
||||
// @target: es5
|
||||
// @module: commonjs
|
||||
// @moduleResolution: classic
|
||||
// @experimentalDecorators: true
|
||||
// @emitDecoratorMetadata: true
|
||||
// @filename: external.ts
|
||||
export class A { }
|
||||
export class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: script.ts
|
||||
class A { }
|
||||
class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
// @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 __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;
|
||||
17
tests/cases/compiler/importHelpersAmd.ts
Normal file
17
tests/cases/compiler/importHelpersAmd.ts
Normal file
@ -0,0 +1,17 @@
|
||||
// @importHelpers: true
|
||||
// @target: es5
|
||||
// @module: amd
|
||||
// @filename: a.ts
|
||||
export class A { }
|
||||
|
||||
// @filename: b.ts
|
||||
import { A } 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 __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;
|
||||
16
tests/cases/compiler/importHelpersES6.ts
Normal file
16
tests/cases/compiler/importHelpersES6.ts
Normal file
@ -0,0 +1,16 @@
|
||||
// @importHelpers: true
|
||||
// @target: es6
|
||||
// @experimentalDecorators: true
|
||||
// @filename: a.ts
|
||||
declare var dec: any;
|
||||
@dec export class 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 __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;
|
||||
38
tests/cases/compiler/importHelpersInIsolatedModules.ts
Normal file
38
tests/cases/compiler/importHelpersInIsolatedModules.ts
Normal file
@ -0,0 +1,38 @@
|
||||
// @importHelpers: true
|
||||
// @isolatedModules: true
|
||||
// @target: es5
|
||||
// @module: commonjs
|
||||
// @moduleResolution: classic
|
||||
// @experimentalDecorators: true
|
||||
// @emitDecoratorMetadata: true
|
||||
// @filename: external.ts
|
||||
export class A { }
|
||||
export class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: script.ts
|
||||
class A { }
|
||||
class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
// @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 __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;
|
||||
24
tests/cases/compiler/importHelpersInTsx.tsx
Normal file
24
tests/cases/compiler/importHelpersInTsx.tsx
Normal file
@ -0,0 +1,24 @@
|
||||
// @importHelpers: true
|
||||
// @target: es5
|
||||
// @module: commonjs
|
||||
// @moduleResolution: classic
|
||||
// @jsx: react
|
||||
// @experimentalDecorators: true
|
||||
// @emitDecoratorMetadata: true
|
||||
// @filename: external.tsx
|
||||
declare var React: any;
|
||||
declare var o: any;
|
||||
export const x = <span {...o} />
|
||||
|
||||
// @filename: script.tsx
|
||||
declare var React: any;
|
||||
declare var o: any;
|
||||
const x = <span {...o} />
|
||||
|
||||
// @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 __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;
|
||||
32
tests/cases/compiler/importHelpersNoHelpers.ts
Normal file
32
tests/cases/compiler/importHelpersNoHelpers.ts
Normal file
@ -0,0 +1,32 @@
|
||||
// @importHelpers: true
|
||||
// @target: es5
|
||||
// @module: commonjs
|
||||
// @moduleResolution: classic
|
||||
// @experimentalDecorators: true
|
||||
// @emitDecoratorMetadata: true
|
||||
// @filename: external.ts
|
||||
export class A { }
|
||||
export class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: script.ts
|
||||
class A { }
|
||||
class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: tslib.d.ts
|
||||
export {}
|
||||
29
tests/cases/compiler/importHelpersNoModule.ts
Normal file
29
tests/cases/compiler/importHelpersNoModule.ts
Normal file
@ -0,0 +1,29 @@
|
||||
// @importHelpers: true
|
||||
// @target: es5
|
||||
// @module: commonjs
|
||||
// @moduleResolution: classic
|
||||
// @experimentalDecorators: true
|
||||
// @emitDecoratorMetadata: true
|
||||
// @filename: external.ts
|
||||
export class A { }
|
||||
export class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
|
||||
// @filename: script.ts
|
||||
class A { }
|
||||
class B extends A { }
|
||||
|
||||
declare var dec: any;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
method(@dec x: number) {
|
||||
}
|
||||
}
|
||||
22
tests/cases/compiler/importHelpersOutFile.ts
Normal file
22
tests/cases/compiler/importHelpersOutFile.ts
Normal file
@ -0,0 +1,22 @@
|
||||
// @importHelpers: true
|
||||
// @target: es5
|
||||
// @module: amd
|
||||
// @outfile: out.js
|
||||
// @filename: a.ts
|
||||
export class A { }
|
||||
|
||||
// @filename: b.ts
|
||||
import { A } from "./a";
|
||||
export class B extends A { }
|
||||
|
||||
// @filename: c.ts
|
||||
import { A } from "./a";
|
||||
export class C 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 __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;
|
||||
17
tests/cases/compiler/importHelpersSystem.ts
Normal file
17
tests/cases/compiler/importHelpersSystem.ts
Normal file
@ -0,0 +1,17 @@
|
||||
// @importHelpers: true
|
||||
// @target: es5
|
||||
// @module: system
|
||||
// @filename: a.ts
|
||||
export class A { }
|
||||
|
||||
// @filename: b.ts
|
||||
import { A } 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 __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;
|
||||
Loading…
x
Reference in New Issue
Block a user