Import assertion (#40698)

* Add parsing

* fix all api

* check gramma of import call

* Add more part of assertion

* Add some case

* Add baseline

* use module insted of target

* strip assertion in d.ts

* Update new baseline

* accept baseline

* Revert error number changes

* Update diagnostic message

* Accept baseline

* rename path

* Fix cr issues

* Accept baseline

* Accept baseline

* Error if assertion and typeonly import

* Accept baseline

* Make lint happy

* Add some comment

* Fix cr issues

* Fix more issue

* Incorporate PR feedback, fix module resolution for import()

* Add contextual type and completions for ImportCall options argument

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
This commit is contained in:
Wenlu Wang 2021-09-21 05:15:22 +08:00 committed by GitHub
parent 5ef043987a
commit ec114b8931
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
86 changed files with 2954 additions and 605 deletions

View file

@ -933,6 +933,7 @@ namespace ts {
let deferredGlobalTemplateStringsArrayType: ObjectType | undefined;
let deferredGlobalImportMetaType: ObjectType;
let deferredGlobalImportMetaExpressionType: ObjectType;
let deferredGlobalImportCallOptionsType: ObjectType | undefined;
let deferredGlobalExtractSymbol: Symbol | undefined;
let deferredGlobalOmitSymbol: Symbol | undefined;
let deferredGlobalAwaitedSymbol: Symbol | undefined;
@ -6568,7 +6569,7 @@ namespace ts {
function inlineExportModifiers(statements: Statement[]) {
// Pass 3: Move all `export {}`'s to `export` modifiers where possible
const index = findIndex(statements, d => isExportDeclaration(d) && !d.moduleSpecifier && !!d.exportClause && isNamedExports(d.exportClause));
const index = findIndex(statements, d => isExportDeclaration(d) && !d.moduleSpecifier && !d.assertClause && !!d.exportClause && isNamedExports(d.exportClause));
if (index >= 0) {
const exportDecl = statements[index] as ExportDeclaration & { readonly exportClause: NamedExports };
const replacements = mapDefined(exportDecl.exportClause.elements, e => {
@ -6600,7 +6601,8 @@ namespace ts {
exportDecl.exportClause,
replacements
),
exportDecl.moduleSpecifier
exportDecl.moduleSpecifier,
exportDecl.assertClause
);
}
}
@ -7260,7 +7262,8 @@ namespace ts {
propertyName && isIdentifier(propertyName) ? factory.createIdentifier(idText(propertyName)) : undefined,
factory.createIdentifier(localName)
)])),
factory.createStringLiteral(specifier)
factory.createStringLiteral(specifier),
/*importClause*/ undefined
), ModifierFlags.None);
break;
}
@ -7336,7 +7339,8 @@ namespace ts {
// We use `target.parent || target` below as `target.parent` is unset when the target is a module which has been export assigned
// And then made into a default by the `esModuleInterop` or `allowSyntheticDefaultImports` flag
// In such cases, the `target` refers to the module itself already
factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context))
factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)),
/*assertClause*/ undefined
), ModifierFlags.None);
break;
case SyntaxKind.NamespaceImport:
@ -7344,7 +7348,8 @@ namespace ts {
/*decorators*/ undefined,
/*modifiers*/ undefined,
factory.createImportClause(/*isTypeOnly*/ false, /*importClause*/ undefined, factory.createNamespaceImport(factory.createIdentifier(localName))),
factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))
factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)),
/*assertClause*/ undefined
), ModifierFlags.None);
break;
case SyntaxKind.NamespaceExport:
@ -7369,7 +7374,8 @@ namespace ts {
factory.createIdentifier(localName)
)
])),
factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context))
factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)),
/*assertClause*/ undefined
), ModifierFlags.None);
break;
case SyntaxKind.ExportSpecifier:
@ -13455,6 +13461,10 @@ namespace ts {
return deferredGlobalImportMetaExpressionType;
}
function getGlobalImportCallOptionsType(reportErrors: boolean) {
return (deferredGlobalImportCallOptionsType ||= getGlobalType("ImportCallOptions" as __String, /*arity*/ 0, reportErrors)) || emptyObjectType;
}
function getGlobalESSymbolConstructorSymbol(reportErrors: boolean): Symbol | undefined {
return deferredGlobalESSymbolConstructorSymbol ||= getGlobalValueSymbol("Symbol" as __String, reportErrors);
}
@ -25547,6 +25557,12 @@ namespace ts {
}
function getContextualTypeForArgumentAtIndex(callTarget: CallLikeExpression, argIndex: number): Type {
if (isImportCall(callTarget)) {
return argIndex === 0 ? stringType :
argIndex === 1 ? getGlobalImportCallOptionsType(/*reportErrors*/ false) :
anyType;
}
// If we're already in the process of resolving the given signature, don't resolve again as
// that could cause infinite recursion. Instead, return anySignature.
const signature = getNodeLinks(callTarget).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(callTarget);
@ -26007,10 +26023,6 @@ namespace ts {
case SyntaxKind.AwaitExpression:
return getContextualTypeForAwaitOperand(parent as AwaitExpression, contextFlags);
case SyntaxKind.CallExpression:
if ((parent as CallExpression).expression.kind === SyntaxKind.ImportKeyword) {
return stringType;
}
/* falls through */
case SyntaxKind.NewExpression:
return getContextualTypeForArgument(parent as CallExpression | NewExpression, node);
case SyntaxKind.TypeAssertionExpression:
@ -30606,10 +30618,12 @@ namespace ts {
if (node.arguments.length === 0) {
return createPromiseReturnType(node, anyType);
}
const specifier = node.arguments[0];
const specifierType = checkExpressionCached(specifier);
const optionsType = node.arguments.length > 1 ? checkExpressionCached(node.arguments[1]) : undefined;
// Even though multiple arguments is grammatically incorrect, type-check extra arguments for completion
for (let i = 1; i < node.arguments.length; ++i) {
for (let i = 2; i < node.arguments.length; ++i) {
checkExpressionCached(node.arguments[i]);
}
@ -30617,6 +30631,13 @@ namespace ts {
error(specifier, Diagnostics.Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0, typeToString(specifierType));
}
if (optionsType) {
const importCallOptionsType = getGlobalImportCallOptionsType(/*reportErrors*/ true);
if (importCallOptionsType !== emptyObjectType) {
checkTypeAssignableTo(optionsType, getNullableType(importCallOptionsType, TypeFlags.Undefined), node.arguments[1]);
}
}
// resolveExternalModuleName will return undefined if the moduleReferenceExpression is not a string literal
const moduleSymbol = resolveExternalModuleName(node, specifier);
if (moduleSymbol) {
@ -39039,6 +39060,18 @@ namespace ts {
}
}
function checkAssertClause(declaration: ImportDeclaration | ExportDeclaration) {
if (declaration.assertClause) {
if (moduleKind !== ModuleKind.ESNext) {
return grammarErrorOnNode(declaration.assertClause, Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext);
}
if (isImportDeclaration(declaration) ? declaration.importClause?.isTypeOnly : declaration.isTypeOnly) {
return grammarErrorOnNode(declaration.assertClause, Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports);
}
}
}
function checkImportDeclaration(node: ImportDeclaration) {
if (checkGrammarModuleElementContext(node, Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) {
// If we hit an import declaration in an illegal context, just bail out to avoid cascading errors.
@ -39070,7 +39103,7 @@ namespace ts {
}
}
}
checkAssertClause(node);
}
function checkImportEqualsDeclaration(node: ImportEqualsDeclaration) {
@ -39165,6 +39198,7 @@ namespace ts {
}
}
}
checkAssertClause(node);
}
function checkGrammarExportDeclaration(node: ExportDeclaration): boolean {
@ -43201,14 +43235,25 @@ namespace ts {
}
const nodeArguments = node.arguments;
if (nodeArguments.length !== 1) {
return grammarErrorOnNode(node, Diagnostics.Dynamic_import_must_have_one_specifier_as_an_argument);
if (moduleKind !== ModuleKind.ESNext) {
// We are allowed trailing comma after proposal-import-assertions.
checkGrammarForDisallowedTrailingComma(nodeArguments);
if (nodeArguments.length > 1) {
const assertionArgument = nodeArguments[1];
return grammarErrorOnNode(assertionArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext);
}
}
checkGrammarForDisallowedTrailingComma(nodeArguments);
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments);
}
// see: parseArgumentOrArrayLiteralElement...we use this function which parse arguments of callExpression to parse specifier for dynamic import.
// parseArgumentOrArrayLiteralElement allows spread element to be in an argument list which is not allowed as specifier in dynamic import.
if (isSpreadElement(nodeArguments[0])) {
return grammarErrorOnNode(nodeArguments[0], Diagnostics.Specifier_of_dynamic_import_cannot_be_spread_element);
const spreadElement = find(nodeArguments, isSpreadElement);
if (spreadElement) {
return grammarErrorOnNode(spreadElement, Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element);
}
return false;
}

View file

@ -924,11 +924,11 @@
"category": "Error",
"code": 1323
},
"Dynamic import must have one specifier as an argument.": {
"Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.": {
"category": "Error",
"code": 1324
},
"Specifier of dynamic import cannot be spread element.": {
"Argument of dynamic import cannot be spread element.": {
"category": "Error",
"code": 1325
},
@ -1388,6 +1388,10 @@
"category": "Message",
"code": 1449
},
"Dynamic imports can only accept a module specifier and an optional assertion as arguments": {
"category": "Message",
"code": 1450
},
"The types of '{0}' are incompatible between these types.": {
"category": "Error",
@ -3304,6 +3308,14 @@
"category": "Error",
"code": 2820
},
"Import assertions are only supported when the '--module' option is set to 'esnext'.": {
"category": "Error",
"code": 2821
},
"Import assertions cannot be used with type-only imports or exports.": {
"category": "Error",
"code": 2822
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",

View file

@ -1515,6 +1515,10 @@ namespace ts {
return emitNamedExports(node as NamedExports);
case SyntaxKind.ExportSpecifier:
return emitExportSpecifier(node as ExportSpecifier);
case SyntaxKind.AssertClause:
return emitAssertClause(node as AssertClause);
case SyntaxKind.AssertEntry:
return emitAssertEntry(node as AssertEntry);
case SyntaxKind.MissingDeclaration:
return;
@ -3322,6 +3326,9 @@ namespace ts {
writeSpace();
}
emitExpression(node.moduleSpecifier);
if (node.assertClause) {
emitWithLeadingSpace(node.assertClause);
}
writeTrailingSemicolon();
}
@ -3390,9 +3397,33 @@ namespace ts {
writeSpace();
emitExpression(node.moduleSpecifier);
}
if (node.assertClause) {
emitWithLeadingSpace(node.assertClause);
}
writeTrailingSemicolon();
}
function emitAssertClause(node: AssertClause) {
emitTokenWithComment(SyntaxKind.AssertKeyword, node.pos, writeKeyword, node);
writeSpace();
const elements = node.elements;
emitList(node, elements, ListFormat.ImportClauseEntries);
}
function emitAssertEntry(node: AssertEntry) {
emit(node.name);
writePunctuation(":");
writeSpace();
const value = node.value;
/** @see {emitPropertyAssignment} */
if ((getEmitFlags(value) & EmitFlags.NoLeadingComments) === 0) {
const commentRange = getCommentRange(value);
emitTrailingCommentsOfPosition(commentRange.pos);
}
emit(value);
}
function emitNamespaceExportDeclaration(node: NamespaceExportDeclaration) {
let nextPos = emitTokenWithComment(SyntaxKind.ExportKeyword, node.pos, writeKeyword, node);
writeSpace();

View file

@ -289,6 +289,10 @@ namespace ts {
updateImportDeclaration,
createImportClause,
updateImportClause,
createAssertClause,
updateAssertClause,
createAssertEntry,
updateAssertEntry,
createNamespaceImport,
updateNamespaceImport,
createNamespaceExport,
@ -3939,7 +3943,8 @@ namespace ts {
decorators: readonly Decorator[] | undefined,
modifiers: readonly Modifier[] | undefined,
importClause: ImportClause | undefined,
moduleSpecifier: Expression
moduleSpecifier: Expression,
assertClause: AssertClause | undefined
): ImportDeclaration {
const node = createBaseDeclaration<ImportDeclaration>(
SyntaxKind.ImportDeclaration,
@ -3948,6 +3953,7 @@ namespace ts {
);
node.importClause = importClause;
node.moduleSpecifier = moduleSpecifier;
node.assertClause = assertClause;
node.transformFlags |=
propagateChildFlags(node.importClause) |
propagateChildFlags(node.moduleSpecifier);
@ -3961,13 +3967,15 @@ namespace ts {
decorators: readonly Decorator[] | undefined,
modifiers: readonly Modifier[] | undefined,
importClause: ImportClause | undefined,
moduleSpecifier: Expression
moduleSpecifier: Expression,
assertClause: AssertClause | undefined
) {
return node.decorators !== decorators
|| node.modifiers !== modifiers
|| node.importClause !== importClause
|| node.moduleSpecifier !== moduleSpecifier
? update(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier), node)
|| node.assertClause !== assertClause
? update(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, assertClause), node)
: node;
}
@ -3996,6 +4004,40 @@ namespace ts {
: node;
}
// @api
function createAssertClause(elements: NodeArray<AssertEntry>, multiLine?: boolean): AssertClause {
const node = createBaseNode<AssertClause>(SyntaxKind.AssertClause);
node.elements = elements;
node.multiLine = multiLine;
node.transformFlags |= TransformFlags.ContainsESNext;
return node;
}
// @api
function updateAssertClause(node: AssertClause, elements: NodeArray<AssertEntry>, multiLine?: boolean): AssertClause {
return node.elements !== elements
|| node.multiLine !== multiLine
? update(createAssertClause(elements, multiLine), node)
: node;
}
// @api
function createAssertEntry(name: AssertionKey, value: StringLiteral): AssertEntry {
const node = createBaseNode<AssertEntry>(SyntaxKind.AssertEntry);
node.name = name;
node.value = value;
node.transformFlags |= TransformFlags.ContainsESNext;
return node;
}
// @api
function updateAssertEntry(node: AssertEntry, name: AssertionKey, value: StringLiteral): AssertEntry {
return node.name !== name
|| node.value !== value
? update(createAssertEntry(name, value), node)
: node;
}
// @api
function createNamespaceImport(name: Identifier): NamespaceImport {
const node = createBaseNode<NamespaceImport>(SyntaxKind.NamespaceImport);
@ -4107,7 +4149,8 @@ namespace ts {
modifiers: readonly Modifier[] | undefined,
isTypeOnly: boolean,
exportClause: NamedExportBindings | undefined,
moduleSpecifier?: Expression
moduleSpecifier?: Expression,
assertClause?: AssertClause
) {
const node = createBaseDeclaration<ExportDeclaration>(
SyntaxKind.ExportDeclaration,
@ -4117,6 +4160,7 @@ namespace ts {
node.isTypeOnly = isTypeOnly;
node.exportClause = exportClause;
node.moduleSpecifier = moduleSpecifier;
node.assertClause = assertClause;
node.transformFlags |=
propagateChildFlags(node.exportClause) |
propagateChildFlags(node.moduleSpecifier);
@ -4131,14 +4175,16 @@ namespace ts {
modifiers: readonly Modifier[] | undefined,
isTypeOnly: boolean,
exportClause: NamedExportBindings | undefined,
moduleSpecifier: Expression | undefined
moduleSpecifier: Expression | undefined,
assertClause: AssertClause | undefined
) {
return node.decorators !== decorators
|| node.modifiers !== modifiers
|| node.isTypeOnly !== isTypeOnly
|| node.exportClause !== exportClause
|| node.moduleSpecifier !== moduleSpecifier
? update(createExportDeclaration(decorators, modifiers, isTypeOnly, exportClause, moduleSpecifier), node)
|| node.assertClause !== assertClause
? update(createExportDeclaration(decorators, modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause), node)
: node;
}
@ -6050,9 +6096,9 @@ namespace ts {
isEnumDeclaration(node) ? updateEnumDeclaration(node, node.decorators, modifiers, node.name, node.members) :
isModuleDeclaration(node) ? updateModuleDeclaration(node, node.decorators, modifiers, node.name, node.body) :
isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, node.decorators, modifiers, node.isTypeOnly, node.name, node.moduleReference) :
isImportDeclaration(node) ? updateImportDeclaration(node, node.decorators, modifiers, node.importClause, node.moduleSpecifier) :
isImportDeclaration(node) ? updateImportDeclaration(node, node.decorators, modifiers, node.importClause, node.moduleSpecifier, node.assertClause) :
isExportAssignment(node) ? updateExportAssignment(node, node.decorators, modifiers, node.expression) :
isExportDeclaration(node) ? updateExportDeclaration(node, node.decorators, modifiers, node.isTypeOnly, node.exportClause, node.moduleSpecifier) :
isExportDeclaration(node) ? updateExportDeclaration(node, node.decorators, modifiers, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause) :
Debug.assertNever(node);
}

View file

@ -597,6 +597,14 @@ namespace ts {
return node.kind === SyntaxKind.ImportClause;
}
export function isAssertClause(node: Node): node is AssertClause {
return node.kind === SyntaxKind.AssertClause;
}
export function isAssertEntry(node: Node): node is AssertEntry {
return node.kind === SyntaxKind.AssertEntry;
}
export function isNamespaceImport(node: Node): node is NamespaceImport {
return node.kind === SyntaxKind.NamespaceImport;
}

View file

@ -522,7 +522,8 @@ namespace ts {
/*decorators*/ undefined,
/*modifiers*/ undefined,
nodeFactory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, namedBindings),
nodeFactory.createStringLiteral(externalHelpersModuleNameText)
nodeFactory.createStringLiteral(externalHelpersModuleNameText),
/*assertClause*/ undefined
);
addEmitFlags(externalHelpersImportDeclaration, EmitFlags.NeverApplyImportHelper);
return externalHelpersImportDeclaration;

View file

@ -398,13 +398,18 @@ namespace ts {
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, (node as ImportDeclaration).importClause) ||
visitNode(cbNode, (node as ImportDeclaration).moduleSpecifier);
visitNode(cbNode, (node as ImportDeclaration).moduleSpecifier) ||
visitNode(cbNode, (node as ImportDeclaration).assertClause);
case SyntaxKind.ImportClause:
return visitNode(cbNode, (node as ImportClause).name) ||
visitNode(cbNode, (node as ImportClause).namedBindings);
case SyntaxKind.AssertClause:
return visitNodes(cbNode, cbNodes, (node as AssertClause).elements);
case SyntaxKind.AssertEntry:
return visitNode(cbNode, (node as AssertEntry).name) ||
visitNode(cbNode, (node as AssertEntry).value);
case SyntaxKind.NamespaceExportDeclaration:
return visitNode(cbNode, (node as NamespaceExportDeclaration).name);
case SyntaxKind.NamespaceImport:
return visitNode(cbNode, (node as NamespaceImport).name);
case SyntaxKind.NamespaceExport:
@ -416,7 +421,8 @@ namespace ts {
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, (node as ExportDeclaration).exportClause) ||
visitNode(cbNode, (node as ExportDeclaration).moduleSpecifier);
visitNode(cbNode, (node as ExportDeclaration).moduleSpecifier) ||
visitNode(cbNode, (node as ExportDeclaration).assertClause);
case SyntaxKind.ImportSpecifier:
case SyntaxKind.ExportSpecifier:
return visitNode(cbNode, (node as ImportOrExportSpecifier).propertyName) ||
@ -1886,6 +1892,11 @@ namespace ts {
token() === SyntaxKind.NumericLiteral;
}
function isAssertionKey(): boolean {
return tokenIsIdentifierOrKeyword(token()) ||
token() === SyntaxKind.StringLiteral;
}
function parsePropertyNameWorker(allowComputedPropertyNames: boolean): PropertyName {
if (token() === SyntaxKind.StringLiteral || token() === SyntaxKind.NumericLiteral) {
const node = parseLiteralNode() as StringLiteral | NumericLiteral;
@ -2051,6 +2062,8 @@ namespace ts {
return isLiteralPropertyName();
case ParsingContext.ObjectBindingElements:
return token() === SyntaxKind.OpenBracketToken || token() === SyntaxKind.DotDotDotToken || isLiteralPropertyName();
case ParsingContext.AssertEntries:
return isAssertionKey();
case ParsingContext.HeritageClauseElement:
// If we see `{ ... }` then only consume it as an expression if it is followed by `,` or `{`
// That way we won't consume the body of a class in its heritage clause.
@ -2171,6 +2184,7 @@ namespace ts {
case ParsingContext.ObjectLiteralMembers:
case ParsingContext.ObjectBindingElements:
case ParsingContext.ImportOrExportSpecifiers:
case ParsingContext.AssertEntries:
return token() === SyntaxKind.CloseBraceToken;
case ParsingContext.SwitchClauseStatements:
return token() === SyntaxKind.CloseBraceToken || token() === SyntaxKind.CaseKeyword || token() === SyntaxKind.DefaultKeyword;
@ -7234,13 +7248,45 @@ namespace ts {
importClause = parseImportClause(identifier, afterImportPos, isTypeOnly);
parseExpected(SyntaxKind.FromKeyword);
}
const moduleSpecifier = parseModuleSpecifier();
let assertClause: AssertClause | undefined;
if (token() === SyntaxKind.AssertKeyword && !scanner.hasPrecedingLineBreak()) {
assertClause = parseAssertClause();
}
parseSemicolon();
const node = factory.createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier);
const node = factory.createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, assertClause);
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
function parseAssertEntry() {
const pos = getNodePos();
const name = tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(SyntaxKind.StringLiteral) as StringLiteral;
parseExpected(SyntaxKind.ColonToken);
const value = parseLiteralLikeNode(SyntaxKind.StringLiteral) as StringLiteral;
return finishNode(factory.createAssertEntry(name, value), pos);
}
function parseAssertClause() {
const pos = getNodePos();
parseExpected(SyntaxKind.AssertKeyword);
const openBracePosition = scanner.getTokenPos();
parseExpected(SyntaxKind.OpenBraceToken);
const multiLine = scanner.hasPrecedingLineBreak();
const elements = parseDelimitedList(ParsingContext.AssertEntries, parseAssertEntry, /*considerSemicolonAsDelimiter*/ true);
if (!parseExpected(SyntaxKind.CloseBraceToken)) {
const lastError = lastOrUndefined(parseDiagnostics);
if (lastError && lastError.code === Diagnostics._0_expected.code) {
addRelatedInfo(
lastError,
createDetachedDiagnostic(fileName, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here)
);
}
}
return finishNode(factory.createAssertClause(elements, multiLine), pos);
}
function tokenAfterImportDefinitelyProducesImportDeclaration() {
return token() === SyntaxKind.AsteriskToken || token() === SyntaxKind.OpenBraceToken;
}
@ -7388,6 +7434,7 @@ namespace ts {
setAwaitContext(/*value*/ true);
let exportClause: NamedExportBindings | undefined;
let moduleSpecifier: Expression | undefined;
let assertClause: AssertClause | undefined;
const isTypeOnly = parseOptional(SyntaxKind.TypeKeyword);
const namespaceExportPos = getNodePos();
if (parseOptional(SyntaxKind.AsteriskToken)) {
@ -7407,9 +7454,12 @@ namespace ts {
moduleSpecifier = parseModuleSpecifier();
}
}
if (moduleSpecifier && token() === SyntaxKind.AssertKeyword && !scanner.hasPrecedingLineBreak()) {
assertClause = parseAssertClause();
}
parseSemicolon();
setAwaitContext(savedAwaitContext);
const node = factory.createExportDeclaration(decorators, modifiers, isTypeOnly, exportClause, moduleSpecifier);
const node = factory.createExportDeclaration(decorators, modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause);
return withJSDoc(finishNode(node, pos), hasJSDoc);
}
@ -7489,7 +7539,8 @@ namespace ts {
TypeArguments, // Type arguments in type argument list
TupleElementTypes, // Element types in tuple element type list
HeritageClauses, // Heritage clauses for a class or interface declaration.
ImportOrExportSpecifiers, // Named import clause's import specifier list
ImportOrExportSpecifiers, // Named import clause's import specifier list,
AssertEntries, // Import entries list.
Count // Number of parsing contexts
}

View file

@ -2269,7 +2269,7 @@ namespace ts {
function createSyntheticImport(text: string, file: SourceFile) {
const externalHelpersModuleReference = factory.createStringLiteral(text);
const importDecl = factory.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, /*importClause*/ undefined, externalHelpersModuleReference);
const importDecl = factory.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, /*importClause*/ undefined, externalHelpersModuleReference, /*assertClause*/ undefined);
addEmitFlags(importDecl, EmitFlags.NeverApplyImportHelper);
setParent(externalHelpersModuleReference, importDecl);
setParent(importDecl, file);
@ -2374,8 +2374,8 @@ namespace ts {
if (isJavaScriptFile && isRequireCall(node, /*checkArgumentIsStringLiteralLike*/ true)) {
imports = append(imports, node.arguments[0]);
}
// we have to check the argument list has length of 1. We will still have to process these even though we have parsing error.
else if (isImportCall(node) && node.arguments.length === 1 && isStringLiteralLike(node.arguments[0])) {
// we have to check the argument list has length of at least 1. We will still have to process these even though we have parsing error.
else if (isImportCall(node) && node.arguments.length >= 1 && isStringLiteralLike(node.arguments[0])) {
imports = append(imports, node.arguments[0]);
}
else if (isLiteralImportTypeNode(node)) {

View file

@ -83,6 +83,7 @@ namespace ts {
any: SyntaxKind.AnyKeyword,
as: SyntaxKind.AsKeyword,
asserts: SyntaxKind.AssertsKeyword,
assert: SyntaxKind.AssertKeyword,
bigint: SyntaxKind.BigIntKeyword,
boolean: SyntaxKind.BooleanKeyword,
break: SyntaxKind.BreakKeyword,

View file

@ -732,7 +732,8 @@ namespace ts {
/*decorators*/ undefined,
decl.modifiers,
decl.importClause,
rewriteModuleSpecifier(decl, decl.moduleSpecifier)
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
/*assertClause*/ undefined
);
}
// The `importClause` visibility corresponds to the default's visibility.
@ -744,7 +745,7 @@ namespace ts {
decl.importClause.isTypeOnly,
visibleDefaultBinding,
/*namedBindings*/ undefined,
), rewriteModuleSpecifier(decl, decl.moduleSpecifier));
), rewriteModuleSpecifier(decl, decl.moduleSpecifier), /*assertClause*/ undefined);
}
if (decl.importClause.namedBindings.kind === SyntaxKind.NamespaceImport) {
// Namespace import (optionally with visible default)
@ -754,7 +755,7 @@ namespace ts {
decl.importClause.isTypeOnly,
visibleDefaultBinding,
namedBindings,
), rewriteModuleSpecifier(decl, decl.moduleSpecifier)) : undefined;
), rewriteModuleSpecifier(decl, decl.moduleSpecifier), /*assertClause*/ undefined) : undefined;
}
// Named imports (optionally with visible default)
const bindingList = mapDefined(decl.importClause.namedBindings.elements, b => resolver.isDeclarationVisible(b) ? b : undefined);
@ -769,7 +770,8 @@ namespace ts {
visibleDefaultBinding,
bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined,
),
rewriteModuleSpecifier(decl, decl.moduleSpecifier)
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
/*assertClause*/ undefined
);
}
// Augmentation of export depends on import
@ -779,7 +781,8 @@ namespace ts {
/*decorators*/ undefined,
decl.modifiers,
/*importClause*/ undefined,
rewriteModuleSpecifier(decl, decl.moduleSpecifier)
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
/*assertClause*/ undefined
);
}
// Nothing visible
@ -1114,6 +1117,7 @@ namespace ts {
input.isTypeOnly,
input.exportClause,
rewriteModuleSpecifier(input, input.moduleSpecifier),
/*assertClause*/ undefined
);
}
case SyntaxKind.ExportAssignment: {

View file

@ -85,7 +85,7 @@ namespace ts {
for (const [importSource, importSpecifiersMap] of arrayFrom(currentFileState.utilizedImplicitRuntimeImports.entries())) {
if (isExternalModule(node)) {
// Add `import` statement
const importStatement = factory.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, factory.createImportClause(/*typeOnly*/ false, /*name*/ undefined, factory.createNamedImports(arrayFrom(importSpecifiersMap.values()))), factory.createStringLiteral(importSource));
const importStatement = factory.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, factory.createImportClause(/*typeOnly*/ false, /*name*/ undefined, factory.createNamedImports(arrayFrom(importSpecifiersMap.values()))), factory.createStringLiteral(importSource), /*assertClause*/ undefined);
setParentRecursive(importStatement, /*incremental*/ false);
statements = insertStatementAfterCustomPrologue(statements.slice(), importStatement);
}

View file

@ -96,6 +96,7 @@ namespace ts {
)
),
node.moduleSpecifier,
node.assertClause
);
setOriginalNode(importDecl, node.exportClause);

View file

@ -2816,7 +2816,8 @@ namespace ts {
/*decorators*/ undefined,
/*modifiers*/ undefined,
importClause,
node.moduleSpecifier)
node.moduleSpecifier,
node.assertClause)
: undefined;
}
@ -2903,7 +2904,8 @@ namespace ts {
/*modifiers*/ undefined,
node.isTypeOnly,
exportClause,
node.moduleSpecifier)
node.moduleSpecifier,
node.assertClause)
: undefined;
}
@ -2973,6 +2975,7 @@ namespace ts {
/*modifiers*/ undefined,
/*importClause*/ undefined,
node.moduleReference.expression,
/*assertClause*/ undefined
),
node,
),

View file

@ -161,6 +161,7 @@ namespace ts {
AbstractKeyword,
AsKeyword,
AssertsKeyword,
AssertKeyword,
AnyKeyword,
AsyncKeyword,
AwaitKeyword,
@ -341,6 +342,8 @@ namespace ts {
DefaultClause,
HeritageClause,
CatchClause,
AssertClause,
AssertEntry,
// Property assignments
PropertyAssignment,
@ -544,6 +547,7 @@ namespace ts {
| SyntaxKind.AnyKeyword
| SyntaxKind.AsKeyword
| SyntaxKind.AssertsKeyword
| SyntaxKind.AssertKeyword
| SyntaxKind.AsyncKeyword
| SyntaxKind.AwaitKeyword
| SyntaxKind.BigIntKeyword
@ -1039,6 +1043,7 @@ namespace ts {
}
export type AssertsKeyword = KeywordToken<SyntaxKind.AssertsKeyword>;
export type AssertKeyword = KeywordToken<SyntaxKind.AssertKeyword>;
export type AwaitKeyword = KeywordToken<SyntaxKind.AwaitKeyword>;
/** @deprecated Use `AwaitKeyword` instead. */
@ -3014,6 +3019,7 @@ namespace ts {
readonly importClause?: ImportClause;
/** If this is not a StringLiteral it will be a grammar error. */
readonly moduleSpecifier: Expression;
readonly assertClause?: AssertClause;
}
export type NamedImportBindings =
@ -3040,6 +3046,22 @@ namespace ts {
readonly namedBindings?: NamedImportBindings;
}
export type AssertionKey = Identifier | StringLiteral;
export interface AssertEntry extends Node {
readonly kind: SyntaxKind.AssertEntry;
readonly parent: AssertClause;
readonly name: AssertionKey;
readonly value: StringLiteral;
}
export interface AssertClause extends Node {
readonly kind: SyntaxKind.AssertClause;
readonly parent: ImportDeclaration | ExportDeclaration
readonly elements: NodeArray<AssertEntry>;
readonly multiLine?: boolean;
}
export interface NamespaceImport extends NamedDeclaration {
readonly kind: SyntaxKind.NamespaceImport;
readonly parent: ImportClause;
@ -3067,6 +3089,7 @@ namespace ts {
readonly exportClause?: NamedExportBindings;
/** If this is not a StringLiteral it will be a grammar error. */
readonly moduleSpecifier?: Expression;
readonly assertClause?: AssertClause;
}
export interface NamedImports extends Node {
@ -7318,10 +7341,14 @@ namespace ts {
updateNamespaceExportDeclaration(node: NamespaceExportDeclaration, name: Identifier): NamespaceExportDeclaration;
createImportEqualsDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration;
updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration;
createImportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression): ImportDeclaration;
updateImportDeclaration(node: ImportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression): ImportDeclaration;
createImportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration;
updateImportDeclaration(node: ImportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration;
createImportClause(isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
updateImportClause(node: ImportClause, isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
createAssertClause(elements: NodeArray<AssertEntry>, multiLine?: boolean): AssertClause;
updateAssertClause(node: AssertClause, elements: NodeArray<AssertEntry>, multiLine?: boolean): AssertClause;
createAssertEntry(name: AssertionKey, value: StringLiteral): AssertEntry;
updateAssertEntry (node: AssertEntry, name: AssertionKey, value: StringLiteral): AssertEntry;
createNamespaceImport(name: Identifier): NamespaceImport;
updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport;
createNamespaceExport(name: Identifier): NamespaceExport;
@ -7332,8 +7359,8 @@ namespace ts {
updateImportSpecifier(node: ImportSpecifier, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier;
createExportAssignment(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment;
updateExportAssignment(node: ExportAssignment, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, expression: Expression): ExportAssignment;
createExportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression): ExportDeclaration;
updateExportDeclaration(node: ExportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined): ExportDeclaration;
createExportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration;
updateExportDeclaration(node: ExportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration;
createNamedExports(elements: readonly ExportSpecifier[]): NamedExports;
updateNamedExports(node: NamedExports, elements: readonly ExportSpecifier[]): NamedExports;
createExportSpecifier(propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier;
@ -8355,6 +8382,7 @@ namespace ts {
ObjectBindingPatternElements = SingleLine | AllowTrailingComma | SpaceBetweenBraces | CommaDelimited | SpaceBetweenSiblings | NoSpaceIfEmpty,
ArrayBindingPatternElements = SingleLine | AllowTrailingComma | CommaDelimited | SpaceBetweenSiblings | NoSpaceIfEmpty,
ObjectLiteralExpressionProperties = PreserveLines | CommaDelimited | SpaceBetweenSiblings | SpaceBetweenBraces | Indented | Braces | NoSpaceIfEmpty,
ImportClauseEntries = PreserveLines | CommaDelimited | SpaceBetweenSiblings | SpaceBetweenBraces | Indented | Braces | NoSpaceIfEmpty,
ArrayLiteralExpressionElements = PreserveLines | CommaDelimited | SpaceBetweenSiblings | AllowTrailingComma | Indented | SquareBrackets,
CommaListElements = CommaDelimited | SpaceBetweenSiblings | SingleLine,
CallExpressionArguments = CommaDelimited | SpaceBetweenSiblings | SingleLine | Parenthesis,

View file

@ -1141,6 +1141,10 @@ namespace ts {
}
}
export function isAssertionKey(node: Node): node is AssertionKey {
return isStringLiteral(node) || isIdentifier(node);
}
export function isStringTextContainingNode(node: Node): node is StringLiteral | TemplateLiteralToken {
return node.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(node.kind);
}

View file

@ -1076,7 +1076,20 @@ namespace ts {
nodesVisitor(node.decorators, visitor, isDecorator),
nodesVisitor(node.modifiers, visitor, isModifier),
nodeVisitor(node.importClause, visitor, isImportClause),
nodeVisitor(node.moduleSpecifier, visitor, isExpression));
nodeVisitor(node.moduleSpecifier, visitor, isExpression),
nodeVisitor(node.assertClause, visitor, isAssertClause));
case SyntaxKind.AssertClause:
Debug.type<AssertClause>(node);
return factory.updateAssertClause(node,
nodesVisitor(node.elements, visitor, isAssertEntry),
node.multiLine);
case SyntaxKind.AssertEntry:
Debug.type<AssertEntry>(node);
return factory.updateAssertEntry(node,
nodeVisitor(node.name, visitor, isAssertionKey),
nodeVisitor(node.value, visitor, isStringLiteral));
case SyntaxKind.ImportClause:
Debug.type<ImportClause>(node);
@ -1120,7 +1133,8 @@ namespace ts {
nodesVisitor(node.modifiers, visitor, isModifier),
node.isTypeOnly,
nodeVisitor(node.exportClause, visitor, isNamedExportBindings),
nodeVisitor(node.moduleSpecifier, visitor, isExpression));
nodeVisitor(node.moduleSpecifier, visitor, isExpression),
nodeVisitor(node.assertClause, visitor, isAssertClause));
case SyntaxKind.NamedExports:
Debug.type<NamedExports>(node);

View file

@ -1224,7 +1224,7 @@ namespace ts {
exportClause: NamedExportBindings | undefined,
moduleSpecifier: Expression | undefined,
isTypeOnly: boolean) {
return factory.updateExportDeclaration(node, decorators, modifiers, isTypeOnly, exportClause, moduleSpecifier);
return factory.updateExportDeclaration(node, decorators, modifiers, isTypeOnly, exportClause, moduleSpecifier, node.assertClause);
}, factoryDeprecation);
/** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */

View file

@ -1061,6 +1061,8 @@ namespace FourSlashInterface {
interfaceEntry("NumberConstructor"),
interfaceEntry("TemplateStringsArray"),
interfaceEntry("ImportMeta"),
interfaceEntry("ImportCallOptions"),
interfaceEntry("ImportAssertions"),
varEntry("Math"),
varEntry("Date"),
interfaceEntry("DateConstructor"),

17
src/lib/es5.d.ts vendored
View file

@ -597,6 +597,23 @@ interface TemplateStringsArray extends ReadonlyArray<string> {
interface ImportMeta {
}
/**
* The type for the optional second argument to `import()`.
*
* If your host environment supports additional options, this type may be
* augmented via interface merging.
*/
interface ImportCallOptions {
assert?: ImportAssertions;
}
/**
* The type for the `assert` property of the optional second argument to `import()`.
*/
interface ImportAssertions {
[key: string]: string;
}
interface Math {
/** The mathematical constant e. This is Euler's number, the base of natural logarithms. */
readonly E: number;

View file

@ -44,13 +44,17 @@ namespace ts.codefix {
exportDeclaration.modifiers,
/*isTypeOnly*/ false,
factory.updateNamedExports(exportClause, filter(exportClause.elements, e => !contains(typeExportSpecifiers, e))),
exportDeclaration.moduleSpecifier);
exportDeclaration.moduleSpecifier,
/*assertClause*/ undefined
);
const typeExportDeclaration = factory.createExportDeclaration(
/*decorators*/ undefined,
/*modifiers*/ undefined,
/*isTypeOnly*/ true,
factory.createNamedExports(typeExportSpecifiers),
exportDeclaration.moduleSpecifier);
exportDeclaration.moduleSpecifier,
/*assertClause*/ undefined
);
changes.replaceNode(context.sourceFile, exportDeclaration, valueExportDeclaration, {
leadingTriviaOption: textChanges.LeadingTriviaOption.IncludeAll,

View file

@ -46,7 +46,8 @@ namespace ts.codefix {
/*isTypeOnly*/ true,
importClause.name,
/*namedBindings*/ undefined),
importDeclaration.moduleSpecifier));
importDeclaration.moduleSpecifier,
/*assertClause*/ undefined));
}
}
}

View file

@ -857,7 +857,8 @@ namespace ts.codefix {
typeOnly,
/*name*/ undefined,
factory.createNamespaceImport(factory.createIdentifier(namespaceLikeImport.name))),
quotedModuleSpecifier);
quotedModuleSpecifier,
/*assertClause*/ undefined);
statements = combine(statements, declaration);
}
return Debug.checkDefined(statements);

View file

@ -25,7 +25,7 @@ namespace ts.codefix {
const { allowSyntheticDefaults, defaultImportName, namedImports, statement, required } = info;
changes.replaceNode(sourceFile, statement, defaultImportName && !allowSyntheticDefaults
? factory.createImportEqualsDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, /*isTypeOnly*/ false, defaultImportName, factory.createExternalModuleReference(required))
: factory.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, defaultImportName, namedImports), required));
: factory.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, defaultImportName, namedImports), required, /*assertClause*/ undefined));
}
interface Info {

View file

@ -32,12 +32,14 @@ namespace ts.codefix {
importDeclaration.decorators,
importDeclaration.modifiers,
factory.updateImportClause(importClause, importClause.isTypeOnly, importClause.name, /*namedBindings*/ undefined),
importDeclaration.moduleSpecifier));
importDeclaration.moduleSpecifier,
importDeclaration.assertClause));
changes.insertNodeAfter(context.sourceFile, importDeclaration, factory.createImportDeclaration(
/*decorators*/ undefined,
/*modifiers*/ undefined,
factory.updateImportClause(importClause, importClause.isTypeOnly, /*name*/ undefined, importClause.namedBindings),
importDeclaration.moduleSpecifier));
importDeclaration.moduleSpecifier,
importDeclaration.assertClause));
}
}

View file

@ -146,7 +146,8 @@ namespace ts.OrganizeImports {
importDecl.decorators,
importDecl.modifiers,
/*importClause*/ undefined,
moduleSpecifier));
moduleSpecifier,
/*assertClause*/ undefined));
}
// If were not in a declaration file, we cant remove the import clause even though
// the imported symbols are unused, because removing them makes it look like the import
@ -358,7 +359,8 @@ namespace ts.OrganizeImports {
factory.updateNamedExports(exportDecl.exportClause, sortedExportSpecifiers) :
factory.updateNamespaceExport(exportDecl.exportClause, exportDecl.exportClause.name)
),
exportDecl.moduleSpecifier));
exportDecl.moduleSpecifier,
exportDecl.assertClause));
}
return coalescedExports;
@ -405,7 +407,8 @@ namespace ts.OrganizeImports {
importDeclaration.decorators,
importDeclaration.modifiers,
factory.updateImportClause(importDeclaration.importClause!, importDeclaration.importClause!.isTypeOnly, name, namedBindings), // TODO: GH#18217
importDeclaration.moduleSpecifier);
importDeclaration.moduleSpecifier,
importDeclaration.assertClause);
}
function sortSpecifiers<T extends ImportOrExportSpecifier>(specifiers: readonly T[]) {

View file

@ -198,6 +198,6 @@ namespace ts.refactor {
function updateImport(old: ImportDeclaration, defaultImportName: Identifier | undefined, elements: readonly ImportSpecifier[] | undefined): ImportDeclaration {
return factory.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined,
factory.createImportClause(/*isTypeOnly*/ false, defaultImportName, elements && elements.length ? factory.createNamedImports(elements) : undefined), old.moduleSpecifier);
factory.createImportClause(/*isTypeOnly*/ false, defaultImportName, elements && elements.length ? factory.createNamedImports(elements) : undefined), old.moduleSpecifier, /*assertClause*/ undefined);
}
}

View file

@ -258,7 +258,8 @@ namespace ts.refactor {
return factory.createImportDeclaration(
/*decorators*/ undefined, /*modifiers*/ undefined,
factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, factory.createNamespaceImport(newNamespaceId)),
newModuleString);
newModuleString,
/*assertClause*/ undefined);
case SyntaxKind.ImportEqualsDeclaration:
return factory.createImportEqualsDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, /*isTypeOnly*/ false, newNamespaceId, factory.createExternalModuleReference(newModuleString));
case SyntaxKind.VariableDeclaration:
@ -591,7 +592,7 @@ namespace ts.refactor {
const defaultImport = clause.name && keep(clause.name) ? clause.name : undefined;
const namedBindings = clause.namedBindings && filterNamedBindings(clause.namedBindings, keep);
return defaultImport || namedBindings
? factory.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, defaultImport, namedBindings), moduleSpecifier)
? factory.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, defaultImport, namedBindings), moduleSpecifier, /*assertClause*/ undefined)
: undefined;
}
case SyntaxKind.ImportEqualsDeclaration:

View file

@ -1880,7 +1880,8 @@ namespace ts {
defaultImport || namedImports
? factory.createImportClause(!!isTypeOnly, defaultImport, namedImports && namedImports.length ? factory.createNamedImports(namedImports) : undefined)
: undefined,
typeof moduleSpecifier === "string" ? makeStringLiteral(moduleSpecifier, quotePreference) : moduleSpecifier);
typeof moduleSpecifier === "string" ? makeStringLiteral(moduleSpecifier, quotePreference) : moduleSpecifier,
/*assertClause*/ undefined);
}
export function makeStringLiteral(text: string, quotePreference: QuotePreference): StringLiteral {

View file

@ -277,7 +277,7 @@ namespace ts {
const exports = [{ name: "x" }];
const exportSpecifiers = exports.map(e => factory.createExportSpecifier(e.name, e.name));
const exportClause = factory.createNamedExports(exportSpecifiers);
const newEd = factory.updateExportDeclaration(ed, ed.decorators, ed.modifiers, ed.isTypeOnly, exportClause, ed.moduleSpecifier);
const newEd = factory.updateExportDeclaration(ed, ed.decorators, ed.modifiers, ed.isTypeOnly, exportClause, ed.moduleSpecifier, ed.assertClause);
return newEd as Node as T;
}
@ -314,7 +314,8 @@ namespace ts {
/*name*/ undefined,
factory.createNamespaceImport(factory.createIdentifier("i0"))
),
/*moduleSpecifier*/ factory.createStringLiteral("./comp1"));
/*moduleSpecifier*/ factory.createStringLiteral("./comp1"),
/*assertClause*/ undefined);
return factory.updateSourceFile(sf, [importStar]);
}
}

View file

@ -234,228 +234,231 @@ declare namespace ts {
AbstractKeyword = 126,
AsKeyword = 127,
AssertsKeyword = 128,
AnyKeyword = 129,
AsyncKeyword = 130,
AwaitKeyword = 131,
BooleanKeyword = 132,
ConstructorKeyword = 133,
DeclareKeyword = 134,
GetKeyword = 135,
InferKeyword = 136,
IntrinsicKeyword = 137,
IsKeyword = 138,
KeyOfKeyword = 139,
ModuleKeyword = 140,
NamespaceKeyword = 141,
NeverKeyword = 142,
ReadonlyKeyword = 143,
RequireKeyword = 144,
NumberKeyword = 145,
ObjectKeyword = 146,
SetKeyword = 147,
StringKeyword = 148,
SymbolKeyword = 149,
TypeKeyword = 150,
UndefinedKeyword = 151,
UniqueKeyword = 152,
UnknownKeyword = 153,
FromKeyword = 154,
GlobalKeyword = 155,
BigIntKeyword = 156,
OverrideKeyword = 157,
OfKeyword = 158,
QualifiedName = 159,
ComputedPropertyName = 160,
TypeParameter = 161,
Parameter = 162,
Decorator = 163,
PropertySignature = 164,
PropertyDeclaration = 165,
MethodSignature = 166,
MethodDeclaration = 167,
ClassStaticBlockDeclaration = 168,
Constructor = 169,
GetAccessor = 170,
SetAccessor = 171,
CallSignature = 172,
ConstructSignature = 173,
IndexSignature = 174,
TypePredicate = 175,
TypeReference = 176,
FunctionType = 177,
ConstructorType = 178,
TypeQuery = 179,
TypeLiteral = 180,
ArrayType = 181,
TupleType = 182,
OptionalType = 183,
RestType = 184,
UnionType = 185,
IntersectionType = 186,
ConditionalType = 187,
InferType = 188,
ParenthesizedType = 189,
ThisType = 190,
TypeOperator = 191,
IndexedAccessType = 192,
MappedType = 193,
LiteralType = 194,
NamedTupleMember = 195,
TemplateLiteralType = 196,
TemplateLiteralTypeSpan = 197,
ImportType = 198,
ObjectBindingPattern = 199,
ArrayBindingPattern = 200,
BindingElement = 201,
ArrayLiteralExpression = 202,
ObjectLiteralExpression = 203,
PropertyAccessExpression = 204,
ElementAccessExpression = 205,
CallExpression = 206,
NewExpression = 207,
TaggedTemplateExpression = 208,
TypeAssertionExpression = 209,
ParenthesizedExpression = 210,
FunctionExpression = 211,
ArrowFunction = 212,
DeleteExpression = 213,
TypeOfExpression = 214,
VoidExpression = 215,
AwaitExpression = 216,
PrefixUnaryExpression = 217,
PostfixUnaryExpression = 218,
BinaryExpression = 219,
ConditionalExpression = 220,
TemplateExpression = 221,
YieldExpression = 222,
SpreadElement = 223,
ClassExpression = 224,
OmittedExpression = 225,
ExpressionWithTypeArguments = 226,
AsExpression = 227,
NonNullExpression = 228,
MetaProperty = 229,
SyntheticExpression = 230,
TemplateSpan = 231,
SemicolonClassElement = 232,
Block = 233,
EmptyStatement = 234,
VariableStatement = 235,
ExpressionStatement = 236,
IfStatement = 237,
DoStatement = 238,
WhileStatement = 239,
ForStatement = 240,
ForInStatement = 241,
ForOfStatement = 242,
ContinueStatement = 243,
BreakStatement = 244,
ReturnStatement = 245,
WithStatement = 246,
SwitchStatement = 247,
LabeledStatement = 248,
ThrowStatement = 249,
TryStatement = 250,
DebuggerStatement = 251,
VariableDeclaration = 252,
VariableDeclarationList = 253,
FunctionDeclaration = 254,
ClassDeclaration = 255,
InterfaceDeclaration = 256,
TypeAliasDeclaration = 257,
EnumDeclaration = 258,
ModuleDeclaration = 259,
ModuleBlock = 260,
CaseBlock = 261,
NamespaceExportDeclaration = 262,
ImportEqualsDeclaration = 263,
ImportDeclaration = 264,
ImportClause = 265,
NamespaceImport = 266,
NamedImports = 267,
ImportSpecifier = 268,
ExportAssignment = 269,
ExportDeclaration = 270,
NamedExports = 271,
NamespaceExport = 272,
ExportSpecifier = 273,
MissingDeclaration = 274,
ExternalModuleReference = 275,
JsxElement = 276,
JsxSelfClosingElement = 277,
JsxOpeningElement = 278,
JsxClosingElement = 279,
JsxFragment = 280,
JsxOpeningFragment = 281,
JsxClosingFragment = 282,
JsxAttribute = 283,
JsxAttributes = 284,
JsxSpreadAttribute = 285,
JsxExpression = 286,
CaseClause = 287,
DefaultClause = 288,
HeritageClause = 289,
CatchClause = 290,
PropertyAssignment = 291,
ShorthandPropertyAssignment = 292,
SpreadAssignment = 293,
EnumMember = 294,
UnparsedPrologue = 295,
UnparsedPrepend = 296,
UnparsedText = 297,
UnparsedInternalText = 298,
UnparsedSyntheticReference = 299,
SourceFile = 300,
Bundle = 301,
UnparsedSource = 302,
InputFiles = 303,
JSDocTypeExpression = 304,
JSDocNameReference = 305,
JSDocMemberName = 306,
JSDocAllType = 307,
JSDocUnknownType = 308,
JSDocNullableType = 309,
JSDocNonNullableType = 310,
JSDocOptionalType = 311,
JSDocFunctionType = 312,
JSDocVariadicType = 313,
JSDocNamepathType = 314,
JSDocComment = 315,
JSDocText = 316,
JSDocTypeLiteral = 317,
JSDocSignature = 318,
JSDocLink = 319,
JSDocLinkCode = 320,
JSDocLinkPlain = 321,
JSDocTag = 322,
JSDocAugmentsTag = 323,
JSDocImplementsTag = 324,
JSDocAuthorTag = 325,
JSDocDeprecatedTag = 326,
JSDocClassTag = 327,
JSDocPublicTag = 328,
JSDocPrivateTag = 329,
JSDocProtectedTag = 330,
JSDocReadonlyTag = 331,
JSDocOverrideTag = 332,
JSDocCallbackTag = 333,
JSDocEnumTag = 334,
JSDocParameterTag = 335,
JSDocReturnTag = 336,
JSDocThisTag = 337,
JSDocTypeTag = 338,
JSDocTemplateTag = 339,
JSDocTypedefTag = 340,
JSDocSeeTag = 341,
JSDocPropertyTag = 342,
SyntaxList = 343,
NotEmittedStatement = 344,
PartiallyEmittedExpression = 345,
CommaListExpression = 346,
MergeDeclarationMarker = 347,
EndOfDeclarationMarker = 348,
SyntheticReferenceExpression = 349,
Count = 350,
AssertKeyword = 129,
AnyKeyword = 130,
AsyncKeyword = 131,
AwaitKeyword = 132,
BooleanKeyword = 133,
ConstructorKeyword = 134,
DeclareKeyword = 135,
GetKeyword = 136,
InferKeyword = 137,
IntrinsicKeyword = 138,
IsKeyword = 139,
KeyOfKeyword = 140,
ModuleKeyword = 141,
NamespaceKeyword = 142,
NeverKeyword = 143,
ReadonlyKeyword = 144,
RequireKeyword = 145,
NumberKeyword = 146,
ObjectKeyword = 147,
SetKeyword = 148,
StringKeyword = 149,
SymbolKeyword = 150,
TypeKeyword = 151,
UndefinedKeyword = 152,
UniqueKeyword = 153,
UnknownKeyword = 154,
FromKeyword = 155,
GlobalKeyword = 156,
BigIntKeyword = 157,
OverrideKeyword = 158,
OfKeyword = 159,
QualifiedName = 160,
ComputedPropertyName = 161,
TypeParameter = 162,
Parameter = 163,
Decorator = 164,
PropertySignature = 165,
PropertyDeclaration = 166,
MethodSignature = 167,
MethodDeclaration = 168,
ClassStaticBlockDeclaration = 169,
Constructor = 170,
GetAccessor = 171,
SetAccessor = 172,
CallSignature = 173,
ConstructSignature = 174,
IndexSignature = 175,
TypePredicate = 176,
TypeReference = 177,
FunctionType = 178,
ConstructorType = 179,
TypeQuery = 180,
TypeLiteral = 181,
ArrayType = 182,
TupleType = 183,
OptionalType = 184,
RestType = 185,
UnionType = 186,
IntersectionType = 187,
ConditionalType = 188,
InferType = 189,
ParenthesizedType = 190,
ThisType = 191,
TypeOperator = 192,
IndexedAccessType = 193,
MappedType = 194,
LiteralType = 195,
NamedTupleMember = 196,
TemplateLiteralType = 197,
TemplateLiteralTypeSpan = 198,
ImportType = 199,
ObjectBindingPattern = 200,
ArrayBindingPattern = 201,
BindingElement = 202,
ArrayLiteralExpression = 203,
ObjectLiteralExpression = 204,
PropertyAccessExpression = 205,
ElementAccessExpression = 206,
CallExpression = 207,
NewExpression = 208,
TaggedTemplateExpression = 209,
TypeAssertionExpression = 210,
ParenthesizedExpression = 211,
FunctionExpression = 212,
ArrowFunction = 213,
DeleteExpression = 214,
TypeOfExpression = 215,
VoidExpression = 216,
AwaitExpression = 217,
PrefixUnaryExpression = 218,
PostfixUnaryExpression = 219,
BinaryExpression = 220,
ConditionalExpression = 221,
TemplateExpression = 222,
YieldExpression = 223,
SpreadElement = 224,
ClassExpression = 225,
OmittedExpression = 226,
ExpressionWithTypeArguments = 227,
AsExpression = 228,
NonNullExpression = 229,
MetaProperty = 230,
SyntheticExpression = 231,
TemplateSpan = 232,
SemicolonClassElement = 233,
Block = 234,
EmptyStatement = 235,
VariableStatement = 236,
ExpressionStatement = 237,
IfStatement = 238,
DoStatement = 239,
WhileStatement = 240,
ForStatement = 241,
ForInStatement = 242,
ForOfStatement = 243,
ContinueStatement = 244,
BreakStatement = 245,
ReturnStatement = 246,
WithStatement = 247,
SwitchStatement = 248,
LabeledStatement = 249,
ThrowStatement = 250,
TryStatement = 251,
DebuggerStatement = 252,
VariableDeclaration = 253,
VariableDeclarationList = 254,
FunctionDeclaration = 255,
ClassDeclaration = 256,
InterfaceDeclaration = 257,
TypeAliasDeclaration = 258,
EnumDeclaration = 259,
ModuleDeclaration = 260,
ModuleBlock = 261,
CaseBlock = 262,
NamespaceExportDeclaration = 263,
ImportEqualsDeclaration = 264,
ImportDeclaration = 265,
ImportClause = 266,
NamespaceImport = 267,
NamedImports = 268,
ImportSpecifier = 269,
ExportAssignment = 270,
ExportDeclaration = 271,
NamedExports = 272,
NamespaceExport = 273,
ExportSpecifier = 274,
MissingDeclaration = 275,
ExternalModuleReference = 276,
JsxElement = 277,
JsxSelfClosingElement = 278,
JsxOpeningElement = 279,
JsxClosingElement = 280,
JsxFragment = 281,
JsxOpeningFragment = 282,
JsxClosingFragment = 283,
JsxAttribute = 284,
JsxAttributes = 285,
JsxSpreadAttribute = 286,
JsxExpression = 287,
CaseClause = 288,
DefaultClause = 289,
HeritageClause = 290,
CatchClause = 291,
AssertClause = 292,
AssertEntry = 293,
PropertyAssignment = 294,
ShorthandPropertyAssignment = 295,
SpreadAssignment = 296,
EnumMember = 297,
UnparsedPrologue = 298,
UnparsedPrepend = 299,
UnparsedText = 300,
UnparsedInternalText = 301,
UnparsedSyntheticReference = 302,
SourceFile = 303,
Bundle = 304,
UnparsedSource = 305,
InputFiles = 306,
JSDocTypeExpression = 307,
JSDocNameReference = 308,
JSDocMemberName = 309,
JSDocAllType = 310,
JSDocUnknownType = 311,
JSDocNullableType = 312,
JSDocNonNullableType = 313,
JSDocOptionalType = 314,
JSDocFunctionType = 315,
JSDocVariadicType = 316,
JSDocNamepathType = 317,
JSDocComment = 318,
JSDocText = 319,
JSDocTypeLiteral = 320,
JSDocSignature = 321,
JSDocLink = 322,
JSDocLinkCode = 323,
JSDocLinkPlain = 324,
JSDocTag = 325,
JSDocAugmentsTag = 326,
JSDocImplementsTag = 327,
JSDocAuthorTag = 328,
JSDocDeprecatedTag = 329,
JSDocClassTag = 330,
JSDocPublicTag = 331,
JSDocPrivateTag = 332,
JSDocProtectedTag = 333,
JSDocReadonlyTag = 334,
JSDocOverrideTag = 335,
JSDocCallbackTag = 336,
JSDocEnumTag = 337,
JSDocParameterTag = 338,
JSDocReturnTag = 339,
JSDocThisTag = 340,
JSDocTypeTag = 341,
JSDocTemplateTag = 342,
JSDocTypedefTag = 343,
JSDocSeeTag = 344,
JSDocPropertyTag = 345,
SyntaxList = 346,
NotEmittedStatement = 347,
PartiallyEmittedExpression = 348,
CommaListExpression = 349,
MergeDeclarationMarker = 350,
EndOfDeclarationMarker = 351,
SyntheticReferenceExpression = 352,
Count = 353,
FirstAssignment = 63,
LastAssignment = 78,
FirstCompoundAssignment = 64,
@ -463,15 +466,15 @@ declare namespace ts {
FirstReservedWord = 81,
LastReservedWord = 116,
FirstKeyword = 81,
LastKeyword = 158,
LastKeyword = 159,
FirstFutureReservedWord = 117,
LastFutureReservedWord = 125,
FirstTypeNode = 175,
LastTypeNode = 198,
FirstTypeNode = 176,
LastTypeNode = 199,
FirstPunctuation = 18,
LastPunctuation = 78,
FirstToken = 0,
LastToken = 158,
LastToken = 159,
FirstTriviaToken = 2,
LastTriviaToken = 7,
FirstLiteralToken = 8,
@ -480,19 +483,19 @@ declare namespace ts {
LastTemplateToken = 17,
FirstBinaryOperator = 29,
LastBinaryOperator = 78,
FirstStatement = 235,
LastStatement = 251,
FirstNode = 159,
FirstJSDocNode = 304,
LastJSDocNode = 342,
FirstJSDocTagNode = 322,
LastJSDocTagNode = 342,
FirstStatement = 236,
LastStatement = 252,
FirstNode = 160,
FirstJSDocNode = 307,
LastJSDocNode = 345,
FirstJSDocTagNode = 325,
LastJSDocTagNode = 345,
}
export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia;
export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral;
export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail;
export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken;
export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword;
export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword;
export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword;
export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword;
export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind;
@ -597,6 +600,7 @@ declare namespace ts {
export interface KeywordToken<TKind extends KeywordSyntaxKind> extends Token<TKind> {
}
export type AssertsKeyword = KeywordToken<SyntaxKind.AssertsKeyword>;
export type AssertKeyword = KeywordToken<SyntaxKind.AssertKeyword>;
export type AwaitKeyword = KeywordToken<SyntaxKind.AwaitKeyword>;
/** @deprecated Use `AwaitKeyword` instead. */
export type AwaitKeywordToken = AwaitKeyword;
@ -1630,6 +1634,7 @@ declare namespace ts {
readonly importClause?: ImportClause;
/** If this is not a StringLiteral it will be a grammar error. */
readonly moduleSpecifier: Expression;
readonly assertClause?: AssertClause;
}
export type NamedImportBindings = NamespaceImport | NamedImports;
export type NamedExportBindings = NamespaceExport | NamedExports;
@ -1640,6 +1645,19 @@ declare namespace ts {
readonly name?: Identifier;
readonly namedBindings?: NamedImportBindings;
}
export type AssertionKey = Identifier | StringLiteral;
export interface AssertEntry extends Node {
readonly kind: SyntaxKind.AssertEntry;
readonly parent: AssertClause;
readonly name: AssertionKey;
readonly value: StringLiteral;
}
export interface AssertClause extends Node {
readonly kind: SyntaxKind.AssertClause;
readonly parent: ImportDeclaration | ExportDeclaration;
readonly elements: NodeArray<AssertEntry>;
readonly multiLine?: boolean;
}
export interface NamespaceImport extends NamedDeclaration {
readonly kind: SyntaxKind.NamespaceImport;
readonly parent: ImportClause;
@ -1662,6 +1680,7 @@ declare namespace ts {
readonly exportClause?: NamedExportBindings;
/** If this is not a StringLiteral it will be a grammar error. */
readonly moduleSpecifier?: Expression;
readonly assertClause?: AssertClause;
}
export interface NamedImports extends Node {
readonly kind: SyntaxKind.NamedImports;
@ -3519,10 +3538,14 @@ declare namespace ts {
updateNamespaceExportDeclaration(node: NamespaceExportDeclaration, name: Identifier): NamespaceExportDeclaration;
createImportEqualsDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration;
updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration;
createImportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression): ImportDeclaration;
updateImportDeclaration(node: ImportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression): ImportDeclaration;
createImportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration;
updateImportDeclaration(node: ImportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration;
createImportClause(isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
updateImportClause(node: ImportClause, isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
createAssertClause(elements: NodeArray<AssertEntry>, multiLine?: boolean): AssertClause;
updateAssertClause(node: AssertClause, elements: NodeArray<AssertEntry>, multiLine?: boolean): AssertClause;
createAssertEntry(name: AssertionKey, value: StringLiteral): AssertEntry;
updateAssertEntry(node: AssertEntry, name: AssertionKey, value: StringLiteral): AssertEntry;
createNamespaceImport(name: Identifier): NamespaceImport;
updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport;
createNamespaceExport(name: Identifier): NamespaceExport;
@ -3533,8 +3556,8 @@ declare namespace ts {
updateImportSpecifier(node: ImportSpecifier, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier;
createExportAssignment(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment;
updateExportAssignment(node: ExportAssignment, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, expression: Expression): ExportAssignment;
createExportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression): ExportDeclaration;
updateExportDeclaration(node: ExportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined): ExportDeclaration;
createExportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration;
updateExportDeclaration(node: ExportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration;
createNamedExports(elements: readonly ExportSpecifier[]): NamedExports;
updateNamedExports(node: NamedExports, elements: readonly ExportSpecifier[]): NamedExports;
createExportSpecifier(propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier;
@ -3951,6 +3974,7 @@ declare namespace ts {
ObjectBindingPatternElements = 525136,
ArrayBindingPatternElements = 524880,
ObjectLiteralExpressionProperties = 526226,
ImportClauseEntries = 526226,
ArrayLiteralExpressionElements = 8914,
CommaListElements = 528,
CallExpressionArguments = 2576,
@ -4345,6 +4369,7 @@ declare namespace ts {
function isTemplateMiddleOrTemplateTail(node: Node): node is TemplateMiddle | TemplateTail;
function isImportOrExportSpecifier(node: Node): node is ImportSpecifier | ExportSpecifier;
function isTypeOnlyImportOrExportDeclaration(node: Node): node is TypeOnlyAliasDeclaration;
function isAssertionKey(node: Node): node is AssertionKey;
function isStringTextContainingNode(node: Node): node is StringLiteral | TemplateLiteralToken;
function isModifier(node: Node): node is Modifier;
function isEntityName(node: Node): node is EntityName;
@ -4592,6 +4617,8 @@ declare namespace ts {
function isImportEqualsDeclaration(node: Node): node is ImportEqualsDeclaration;
function isImportDeclaration(node: Node): node is ImportDeclaration;
function isImportClause(node: Node): node is ImportClause;
function isAssertClause(node: Node): node is AssertClause;
function isAssertEntry(node: Node): node is AssertEntry;
function isNamespaceImport(node: Node): node is NamespaceImport;
function isNamespaceExport(node: Node): node is NamespaceExport;
function isNamedImports(node: Node): node is NamedImports;
@ -10961,9 +10988,9 @@ declare namespace ts {
/** @deprecated Use `factory.updateImportEqualsDeclaration` or the factory supplied by your transformation context instead. */
const updateImportEqualsDeclaration: (node: ImportEqualsDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference) => ImportEqualsDeclaration;
/** @deprecated Use `factory.createImportDeclaration` or the factory supplied by your transformation context instead. */
const createImportDeclaration: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression) => ImportDeclaration;
const createImportDeclaration: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause | undefined) => ImportDeclaration;
/** @deprecated Use `factory.updateImportDeclaration` or the factory supplied by your transformation context instead. */
const updateImportDeclaration: (node: ImportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression) => ImportDeclaration;
const updateImportDeclaration: (node: ImportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined) => ImportDeclaration;
/** @deprecated Use `factory.createNamespaceImport` or the factory supplied by your transformation context instead. */
const createNamespaceImport: (name: Identifier) => NamespaceImport;
/** @deprecated Use `factory.updateNamespaceImport` or the factory supplied by your transformation context instead. */

View file

@ -234,228 +234,231 @@ declare namespace ts {
AbstractKeyword = 126,
AsKeyword = 127,
AssertsKeyword = 128,
AnyKeyword = 129,
AsyncKeyword = 130,
AwaitKeyword = 131,
BooleanKeyword = 132,
ConstructorKeyword = 133,
DeclareKeyword = 134,
GetKeyword = 135,
InferKeyword = 136,
IntrinsicKeyword = 137,
IsKeyword = 138,
KeyOfKeyword = 139,
ModuleKeyword = 140,
NamespaceKeyword = 141,
NeverKeyword = 142,
ReadonlyKeyword = 143,
RequireKeyword = 144,
NumberKeyword = 145,
ObjectKeyword = 146,
SetKeyword = 147,
StringKeyword = 148,
SymbolKeyword = 149,
TypeKeyword = 150,
UndefinedKeyword = 151,
UniqueKeyword = 152,
UnknownKeyword = 153,
FromKeyword = 154,
GlobalKeyword = 155,
BigIntKeyword = 156,
OverrideKeyword = 157,
OfKeyword = 158,
QualifiedName = 159,
ComputedPropertyName = 160,
TypeParameter = 161,
Parameter = 162,
Decorator = 163,
PropertySignature = 164,
PropertyDeclaration = 165,
MethodSignature = 166,
MethodDeclaration = 167,
ClassStaticBlockDeclaration = 168,
Constructor = 169,
GetAccessor = 170,
SetAccessor = 171,
CallSignature = 172,
ConstructSignature = 173,
IndexSignature = 174,
TypePredicate = 175,
TypeReference = 176,
FunctionType = 177,
ConstructorType = 178,
TypeQuery = 179,
TypeLiteral = 180,
ArrayType = 181,
TupleType = 182,
OptionalType = 183,
RestType = 184,
UnionType = 185,
IntersectionType = 186,
ConditionalType = 187,
InferType = 188,
ParenthesizedType = 189,
ThisType = 190,
TypeOperator = 191,
IndexedAccessType = 192,
MappedType = 193,
LiteralType = 194,
NamedTupleMember = 195,
TemplateLiteralType = 196,
TemplateLiteralTypeSpan = 197,
ImportType = 198,
ObjectBindingPattern = 199,
ArrayBindingPattern = 200,
BindingElement = 201,
ArrayLiteralExpression = 202,
ObjectLiteralExpression = 203,
PropertyAccessExpression = 204,
ElementAccessExpression = 205,
CallExpression = 206,
NewExpression = 207,
TaggedTemplateExpression = 208,
TypeAssertionExpression = 209,
ParenthesizedExpression = 210,
FunctionExpression = 211,
ArrowFunction = 212,
DeleteExpression = 213,
TypeOfExpression = 214,
VoidExpression = 215,
AwaitExpression = 216,
PrefixUnaryExpression = 217,
PostfixUnaryExpression = 218,
BinaryExpression = 219,
ConditionalExpression = 220,
TemplateExpression = 221,
YieldExpression = 222,
SpreadElement = 223,
ClassExpression = 224,
OmittedExpression = 225,
ExpressionWithTypeArguments = 226,
AsExpression = 227,
NonNullExpression = 228,
MetaProperty = 229,
SyntheticExpression = 230,
TemplateSpan = 231,
SemicolonClassElement = 232,
Block = 233,
EmptyStatement = 234,
VariableStatement = 235,
ExpressionStatement = 236,
IfStatement = 237,
DoStatement = 238,
WhileStatement = 239,
ForStatement = 240,
ForInStatement = 241,
ForOfStatement = 242,
ContinueStatement = 243,
BreakStatement = 244,
ReturnStatement = 245,
WithStatement = 246,
SwitchStatement = 247,
LabeledStatement = 248,
ThrowStatement = 249,
TryStatement = 250,
DebuggerStatement = 251,
VariableDeclaration = 252,
VariableDeclarationList = 253,
FunctionDeclaration = 254,
ClassDeclaration = 255,
InterfaceDeclaration = 256,
TypeAliasDeclaration = 257,
EnumDeclaration = 258,
ModuleDeclaration = 259,
ModuleBlock = 260,
CaseBlock = 261,
NamespaceExportDeclaration = 262,
ImportEqualsDeclaration = 263,
ImportDeclaration = 264,
ImportClause = 265,
NamespaceImport = 266,
NamedImports = 267,
ImportSpecifier = 268,
ExportAssignment = 269,
ExportDeclaration = 270,
NamedExports = 271,
NamespaceExport = 272,
ExportSpecifier = 273,
MissingDeclaration = 274,
ExternalModuleReference = 275,
JsxElement = 276,
JsxSelfClosingElement = 277,
JsxOpeningElement = 278,
JsxClosingElement = 279,
JsxFragment = 280,
JsxOpeningFragment = 281,
JsxClosingFragment = 282,
JsxAttribute = 283,
JsxAttributes = 284,
JsxSpreadAttribute = 285,
JsxExpression = 286,
CaseClause = 287,
DefaultClause = 288,
HeritageClause = 289,
CatchClause = 290,
PropertyAssignment = 291,
ShorthandPropertyAssignment = 292,
SpreadAssignment = 293,
EnumMember = 294,
UnparsedPrologue = 295,
UnparsedPrepend = 296,
UnparsedText = 297,
UnparsedInternalText = 298,
UnparsedSyntheticReference = 299,
SourceFile = 300,
Bundle = 301,
UnparsedSource = 302,
InputFiles = 303,
JSDocTypeExpression = 304,
JSDocNameReference = 305,
JSDocMemberName = 306,
JSDocAllType = 307,
JSDocUnknownType = 308,
JSDocNullableType = 309,
JSDocNonNullableType = 310,
JSDocOptionalType = 311,
JSDocFunctionType = 312,
JSDocVariadicType = 313,
JSDocNamepathType = 314,
JSDocComment = 315,
JSDocText = 316,
JSDocTypeLiteral = 317,
JSDocSignature = 318,
JSDocLink = 319,
JSDocLinkCode = 320,
JSDocLinkPlain = 321,
JSDocTag = 322,
JSDocAugmentsTag = 323,
JSDocImplementsTag = 324,
JSDocAuthorTag = 325,
JSDocDeprecatedTag = 326,
JSDocClassTag = 327,
JSDocPublicTag = 328,
JSDocPrivateTag = 329,
JSDocProtectedTag = 330,
JSDocReadonlyTag = 331,
JSDocOverrideTag = 332,
JSDocCallbackTag = 333,
JSDocEnumTag = 334,
JSDocParameterTag = 335,
JSDocReturnTag = 336,
JSDocThisTag = 337,
JSDocTypeTag = 338,
JSDocTemplateTag = 339,
JSDocTypedefTag = 340,
JSDocSeeTag = 341,
JSDocPropertyTag = 342,
SyntaxList = 343,
NotEmittedStatement = 344,
PartiallyEmittedExpression = 345,
CommaListExpression = 346,
MergeDeclarationMarker = 347,
EndOfDeclarationMarker = 348,
SyntheticReferenceExpression = 349,
Count = 350,
AssertKeyword = 129,
AnyKeyword = 130,
AsyncKeyword = 131,
AwaitKeyword = 132,
BooleanKeyword = 133,
ConstructorKeyword = 134,
DeclareKeyword = 135,
GetKeyword = 136,
InferKeyword = 137,
IntrinsicKeyword = 138,
IsKeyword = 139,
KeyOfKeyword = 140,
ModuleKeyword = 141,
NamespaceKeyword = 142,
NeverKeyword = 143,
ReadonlyKeyword = 144,
RequireKeyword = 145,
NumberKeyword = 146,
ObjectKeyword = 147,
SetKeyword = 148,
StringKeyword = 149,
SymbolKeyword = 150,
TypeKeyword = 151,
UndefinedKeyword = 152,
UniqueKeyword = 153,
UnknownKeyword = 154,
FromKeyword = 155,
GlobalKeyword = 156,
BigIntKeyword = 157,
OverrideKeyword = 158,
OfKeyword = 159,
QualifiedName = 160,
ComputedPropertyName = 161,
TypeParameter = 162,
Parameter = 163,
Decorator = 164,
PropertySignature = 165,
PropertyDeclaration = 166,
MethodSignature = 167,
MethodDeclaration = 168,
ClassStaticBlockDeclaration = 169,
Constructor = 170,
GetAccessor = 171,
SetAccessor = 172,
CallSignature = 173,
ConstructSignature = 174,
IndexSignature = 175,
TypePredicate = 176,
TypeReference = 177,
FunctionType = 178,
ConstructorType = 179,
TypeQuery = 180,
TypeLiteral = 181,
ArrayType = 182,
TupleType = 183,
OptionalType = 184,
RestType = 185,
UnionType = 186,
IntersectionType = 187,
ConditionalType = 188,
InferType = 189,
ParenthesizedType = 190,
ThisType = 191,
TypeOperator = 192,
IndexedAccessType = 193,
MappedType = 194,
LiteralType = 195,
NamedTupleMember = 196,
TemplateLiteralType = 197,
TemplateLiteralTypeSpan = 198,
ImportType = 199,
ObjectBindingPattern = 200,
ArrayBindingPattern = 201,
BindingElement = 202,
ArrayLiteralExpression = 203,
ObjectLiteralExpression = 204,
PropertyAccessExpression = 205,
ElementAccessExpression = 206,
CallExpression = 207,
NewExpression = 208,
TaggedTemplateExpression = 209,
TypeAssertionExpression = 210,
ParenthesizedExpression = 211,
FunctionExpression = 212,
ArrowFunction = 213,
DeleteExpression = 214,
TypeOfExpression = 215,
VoidExpression = 216,
AwaitExpression = 217,
PrefixUnaryExpression = 218,
PostfixUnaryExpression = 219,
BinaryExpression = 220,
ConditionalExpression = 221,
TemplateExpression = 222,
YieldExpression = 223,
SpreadElement = 224,
ClassExpression = 225,
OmittedExpression = 226,
ExpressionWithTypeArguments = 227,
AsExpression = 228,
NonNullExpression = 229,
MetaProperty = 230,
SyntheticExpression = 231,
TemplateSpan = 232,
SemicolonClassElement = 233,
Block = 234,
EmptyStatement = 235,
VariableStatement = 236,
ExpressionStatement = 237,
IfStatement = 238,
DoStatement = 239,
WhileStatement = 240,
ForStatement = 241,
ForInStatement = 242,
ForOfStatement = 243,
ContinueStatement = 244,
BreakStatement = 245,
ReturnStatement = 246,
WithStatement = 247,
SwitchStatement = 248,
LabeledStatement = 249,
ThrowStatement = 250,
TryStatement = 251,
DebuggerStatement = 252,
VariableDeclaration = 253,
VariableDeclarationList = 254,
FunctionDeclaration = 255,
ClassDeclaration = 256,
InterfaceDeclaration = 257,
TypeAliasDeclaration = 258,
EnumDeclaration = 259,
ModuleDeclaration = 260,
ModuleBlock = 261,
CaseBlock = 262,
NamespaceExportDeclaration = 263,
ImportEqualsDeclaration = 264,
ImportDeclaration = 265,
ImportClause = 266,
NamespaceImport = 267,
NamedImports = 268,
ImportSpecifier = 269,
ExportAssignment = 270,
ExportDeclaration = 271,
NamedExports = 272,
NamespaceExport = 273,
ExportSpecifier = 274,
MissingDeclaration = 275,
ExternalModuleReference = 276,
JsxElement = 277,
JsxSelfClosingElement = 278,
JsxOpeningElement = 279,
JsxClosingElement = 280,
JsxFragment = 281,
JsxOpeningFragment = 282,
JsxClosingFragment = 283,
JsxAttribute = 284,
JsxAttributes = 285,
JsxSpreadAttribute = 286,
JsxExpression = 287,
CaseClause = 288,
DefaultClause = 289,
HeritageClause = 290,
CatchClause = 291,
AssertClause = 292,
AssertEntry = 293,
PropertyAssignment = 294,
ShorthandPropertyAssignment = 295,
SpreadAssignment = 296,
EnumMember = 297,
UnparsedPrologue = 298,
UnparsedPrepend = 299,
UnparsedText = 300,
UnparsedInternalText = 301,
UnparsedSyntheticReference = 302,
SourceFile = 303,
Bundle = 304,
UnparsedSource = 305,
InputFiles = 306,
JSDocTypeExpression = 307,
JSDocNameReference = 308,
JSDocMemberName = 309,
JSDocAllType = 310,
JSDocUnknownType = 311,
JSDocNullableType = 312,
JSDocNonNullableType = 313,
JSDocOptionalType = 314,
JSDocFunctionType = 315,
JSDocVariadicType = 316,
JSDocNamepathType = 317,
JSDocComment = 318,
JSDocText = 319,
JSDocTypeLiteral = 320,
JSDocSignature = 321,
JSDocLink = 322,
JSDocLinkCode = 323,
JSDocLinkPlain = 324,
JSDocTag = 325,
JSDocAugmentsTag = 326,
JSDocImplementsTag = 327,
JSDocAuthorTag = 328,
JSDocDeprecatedTag = 329,
JSDocClassTag = 330,
JSDocPublicTag = 331,
JSDocPrivateTag = 332,
JSDocProtectedTag = 333,
JSDocReadonlyTag = 334,
JSDocOverrideTag = 335,
JSDocCallbackTag = 336,
JSDocEnumTag = 337,
JSDocParameterTag = 338,
JSDocReturnTag = 339,
JSDocThisTag = 340,
JSDocTypeTag = 341,
JSDocTemplateTag = 342,
JSDocTypedefTag = 343,
JSDocSeeTag = 344,
JSDocPropertyTag = 345,
SyntaxList = 346,
NotEmittedStatement = 347,
PartiallyEmittedExpression = 348,
CommaListExpression = 349,
MergeDeclarationMarker = 350,
EndOfDeclarationMarker = 351,
SyntheticReferenceExpression = 352,
Count = 353,
FirstAssignment = 63,
LastAssignment = 78,
FirstCompoundAssignment = 64,
@ -463,15 +466,15 @@ declare namespace ts {
FirstReservedWord = 81,
LastReservedWord = 116,
FirstKeyword = 81,
LastKeyword = 158,
LastKeyword = 159,
FirstFutureReservedWord = 117,
LastFutureReservedWord = 125,
FirstTypeNode = 175,
LastTypeNode = 198,
FirstTypeNode = 176,
LastTypeNode = 199,
FirstPunctuation = 18,
LastPunctuation = 78,
FirstToken = 0,
LastToken = 158,
LastToken = 159,
FirstTriviaToken = 2,
LastTriviaToken = 7,
FirstLiteralToken = 8,
@ -480,19 +483,19 @@ declare namespace ts {
LastTemplateToken = 17,
FirstBinaryOperator = 29,
LastBinaryOperator = 78,
FirstStatement = 235,
LastStatement = 251,
FirstNode = 159,
FirstJSDocNode = 304,
LastJSDocNode = 342,
FirstJSDocTagNode = 322,
LastJSDocTagNode = 342,
FirstStatement = 236,
LastStatement = 252,
FirstNode = 160,
FirstJSDocNode = 307,
LastJSDocNode = 345,
FirstJSDocTagNode = 325,
LastJSDocTagNode = 345,
}
export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia;
export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral;
export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail;
export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken;
export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword;
export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword;
export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword;
export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword;
export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind;
@ -597,6 +600,7 @@ declare namespace ts {
export interface KeywordToken<TKind extends KeywordSyntaxKind> extends Token<TKind> {
}
export type AssertsKeyword = KeywordToken<SyntaxKind.AssertsKeyword>;
export type AssertKeyword = KeywordToken<SyntaxKind.AssertKeyword>;
export type AwaitKeyword = KeywordToken<SyntaxKind.AwaitKeyword>;
/** @deprecated Use `AwaitKeyword` instead. */
export type AwaitKeywordToken = AwaitKeyword;
@ -1630,6 +1634,7 @@ declare namespace ts {
readonly importClause?: ImportClause;
/** If this is not a StringLiteral it will be a grammar error. */
readonly moduleSpecifier: Expression;
readonly assertClause?: AssertClause;
}
export type NamedImportBindings = NamespaceImport | NamedImports;
export type NamedExportBindings = NamespaceExport | NamedExports;
@ -1640,6 +1645,19 @@ declare namespace ts {
readonly name?: Identifier;
readonly namedBindings?: NamedImportBindings;
}
export type AssertionKey = Identifier | StringLiteral;
export interface AssertEntry extends Node {
readonly kind: SyntaxKind.AssertEntry;
readonly parent: AssertClause;
readonly name: AssertionKey;
readonly value: StringLiteral;
}
export interface AssertClause extends Node {
readonly kind: SyntaxKind.AssertClause;
readonly parent: ImportDeclaration | ExportDeclaration;
readonly elements: NodeArray<AssertEntry>;
readonly multiLine?: boolean;
}
export interface NamespaceImport extends NamedDeclaration {
readonly kind: SyntaxKind.NamespaceImport;
readonly parent: ImportClause;
@ -1662,6 +1680,7 @@ declare namespace ts {
readonly exportClause?: NamedExportBindings;
/** If this is not a StringLiteral it will be a grammar error. */
readonly moduleSpecifier?: Expression;
readonly assertClause?: AssertClause;
}
export interface NamedImports extends Node {
readonly kind: SyntaxKind.NamedImports;
@ -3519,10 +3538,14 @@ declare namespace ts {
updateNamespaceExportDeclaration(node: NamespaceExportDeclaration, name: Identifier): NamespaceExportDeclaration;
createImportEqualsDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration;
updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration;
createImportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression): ImportDeclaration;
updateImportDeclaration(node: ImportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression): ImportDeclaration;
createImportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration;
updateImportDeclaration(node: ImportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration;
createImportClause(isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
updateImportClause(node: ImportClause, isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
createAssertClause(elements: NodeArray<AssertEntry>, multiLine?: boolean): AssertClause;
updateAssertClause(node: AssertClause, elements: NodeArray<AssertEntry>, multiLine?: boolean): AssertClause;
createAssertEntry(name: AssertionKey, value: StringLiteral): AssertEntry;
updateAssertEntry(node: AssertEntry, name: AssertionKey, value: StringLiteral): AssertEntry;
createNamespaceImport(name: Identifier): NamespaceImport;
updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport;
createNamespaceExport(name: Identifier): NamespaceExport;
@ -3533,8 +3556,8 @@ declare namespace ts {
updateImportSpecifier(node: ImportSpecifier, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier;
createExportAssignment(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment;
updateExportAssignment(node: ExportAssignment, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, expression: Expression): ExportAssignment;
createExportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression): ExportDeclaration;
updateExportDeclaration(node: ExportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined): ExportDeclaration;
createExportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration;
updateExportDeclaration(node: ExportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration;
createNamedExports(elements: readonly ExportSpecifier[]): NamedExports;
updateNamedExports(node: NamedExports, elements: readonly ExportSpecifier[]): NamedExports;
createExportSpecifier(propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier;
@ -3951,6 +3974,7 @@ declare namespace ts {
ObjectBindingPatternElements = 525136,
ArrayBindingPatternElements = 524880,
ObjectLiteralExpressionProperties = 526226,
ImportClauseEntries = 526226,
ArrayLiteralExpressionElements = 8914,
CommaListElements = 528,
CallExpressionArguments = 2576,
@ -4345,6 +4369,7 @@ declare namespace ts {
function isTemplateMiddleOrTemplateTail(node: Node): node is TemplateMiddle | TemplateTail;
function isImportOrExportSpecifier(node: Node): node is ImportSpecifier | ExportSpecifier;
function isTypeOnlyImportOrExportDeclaration(node: Node): node is TypeOnlyAliasDeclaration;
function isAssertionKey(node: Node): node is AssertionKey;
function isStringTextContainingNode(node: Node): node is StringLiteral | TemplateLiteralToken;
function isModifier(node: Node): node is Modifier;
function isEntityName(node: Node): node is EntityName;
@ -4592,6 +4617,8 @@ declare namespace ts {
function isImportEqualsDeclaration(node: Node): node is ImportEqualsDeclaration;
function isImportDeclaration(node: Node): node is ImportDeclaration;
function isImportClause(node: Node): node is ImportClause;
function isAssertClause(node: Node): node is AssertClause;
function isAssertEntry(node: Node): node is AssertEntry;
function isNamespaceImport(node: Node): node is NamespaceImport;
function isNamespaceExport(node: Node): node is NamespaceExport;
function isNamedImports(node: Node): node is NamedImports;
@ -7161,9 +7188,9 @@ declare namespace ts {
/** @deprecated Use `factory.updateImportEqualsDeclaration` or the factory supplied by your transformation context instead. */
const updateImportEqualsDeclaration: (node: ImportEqualsDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference) => ImportEqualsDeclaration;
/** @deprecated Use `factory.createImportDeclaration` or the factory supplied by your transformation context instead. */
const createImportDeclaration: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression) => ImportDeclaration;
const createImportDeclaration: (decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause | undefined) => ImportDeclaration;
/** @deprecated Use `factory.updateImportDeclaration` or the factory supplied by your transformation context instead. */
const updateImportDeclaration: (node: ImportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression) => ImportDeclaration;
const updateImportDeclaration: (node: ImportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined) => ImportDeclaration;
/** @deprecated Use `factory.createNamespaceImport` or the factory supplied by your transformation context instead. */
const createNamespaceImport: (name: Identifier) => NamespaceImport;
/** @deprecated Use `factory.updateNamespaceImport` or the factory supplied by your transformation context instead. */

View file

@ -0,0 +1,140 @@
[
{
"marker": {
"fileName": "/tests/cases/fourslash/main.ts",
"position": 24,
"name": "0"
},
"completionList": {
"isGlobalCompletion": false,
"isMemberCompletion": true,
"isNewIdentifierLocation": false,
"entries": [
{
"name": "assert",
"kind": "property",
"kindModifiers": "declare,optional",
"sortText": "12",
"displayParts": [
{
"text": "(",
"kind": "punctuation"
},
{
"text": "property",
"kind": "text"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "ImportCallOptions",
"kind": "interfaceName"
},
{
"text": ".",
"kind": "punctuation"
},
{
"text": "assert",
"kind": "propertyName"
},
{
"text": "?",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "ImportAssertions",
"kind": "interfaceName"
}
],
"documentation": []
}
]
}
},
{
"marker": {
"fileName": "/tests/cases/fourslash/main.ts",
"position": 57,
"name": "1"
},
"completionList": {
"isGlobalCompletion": false,
"isMemberCompletion": true,
"isNewIdentifierLocation": false,
"optionalReplacementSpan": {
"start": 53,
"length": 4
},
"entries": [
{
"name": "assert",
"kind": "property",
"kindModifiers": "declare,optional",
"sortText": "12",
"displayParts": [
{
"text": "(",
"kind": "punctuation"
},
{
"text": "property",
"kind": "text"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "ImportCallOptions",
"kind": "interfaceName"
},
{
"text": ".",
"kind": "punctuation"
},
{
"text": "assert",
"kind": "propertyName"
},
{
"text": "?",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "ImportAssertions",
"kind": "interfaceName"
}
],
"documentation": []
}
]
}
}
]

View file

@ -41,7 +41,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(
a1(...array2); // Error parameter type is (number|string)[]
~~~~~~
!!! error TS2552: Cannot find name 'array2'. Did you mean 'Array'?
!!! related TS2728 /.ts/lib.es5.d.ts:1447:13: 'Array' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1464:13: 'Array' is declared here.
a5([1, 2, "string", false, true]); // Error, parameter type is [any, any, [[any]]]
~~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type '[[any]]'.

View file

@ -11,7 +11,7 @@ tests/cases/conformance/types/members/duplicateNumericIndexers.ts(25,5): error T
tests/cases/conformance/types/members/duplicateNumericIndexers.ts(29,5): error TS2374: Duplicate index signature for type 'number'.
tests/cases/conformance/types/members/duplicateNumericIndexers.ts(30,5): error TS2374: Duplicate index signature for type 'number'.
lib.es5.d.ts(517,5): error TS2374: Duplicate index signature for type 'number'.
lib.es5.d.ts(1433,5): error TS2374: Duplicate index signature for type 'number'.
lib.es5.d.ts(1450,5): error TS2374: Duplicate index signature for type 'number'.
==== tests/cases/conformance/types/members/duplicateNumericIndexers.ts (12 errors) ====

View file

@ -66,20 +66,20 @@ tests/cases/compiler/externModule.ts(37,3): error TS2552: Cannot find name 'XDat
var d=new XDate();
~~~~~
!!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'?
!!! related TS2728 /.ts/lib.es5.d.ts:910:13: 'Date' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:927:13: 'Date' is declared here.
d.getDay();
d=new XDate(1978,2);
~~~~~
!!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'?
!!! related TS2728 /.ts/lib.es5.d.ts:910:13: 'Date' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:927:13: 'Date' is declared here.
d.getXDate();
var n=XDate.parse("3/2/2004");
~~~~~
!!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'?
!!! related TS2728 /.ts/lib.es5.d.ts:910:13: 'Date' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:927:13: 'Date' is declared here.
n=XDate.UTC(1964,2,1);
~~~~~
!!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'?
!!! related TS2728 /.ts/lib.es5.d.ts:910:13: 'Date' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:927:13: 'Date' is declared here.

View file

@ -0,0 +1,78 @@
tests/cases/conformance/importAssertion/1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/3.ts(2,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/3.ts(3,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/3.ts(4,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/3.ts(5,26): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/3.ts(7,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/3.ts(8,11): message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments
tests/cases/conformance/importAssertion/3.ts(9,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/3.ts(10,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/3.ts(10,52): error TS1009: Trailing comma not allowed.
==== tests/cases/conformance/importAssertion/0.ts (0 errors) ====
export const a = 1;
export const b = 2;
==== tests/cases/conformance/importAssertion/1.ts (3 errors) ====
import './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
import { a, b } from './0' assert { "type": "json" }
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
import * as foo from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
a;
b;
foo.a;
foo.b;
==== tests/cases/conformance/importAssertion/2.ts (2 errors) ====
import { a, b } from './0' assert {}
~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
a;
b;
c;
d;
==== tests/cases/conformance/importAssertion/3.ts (9 errors) ====
const a = import('./0')
const b = import('./0', { assert: { type: "json" } })
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
const d = import('./0', { assert: {} })
~~~~~~~~~~~~~~
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
const dd = import('./0', {})
~~
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
declare function foo(): any;
const e = import('./0', foo())
~~~~~
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
const f = import()
~~~~~~~~
!!! message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments
const g = import('./0', {}, {})
~~
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
const h = import('./0', { assert: { type: "json" }},)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
~
!!! error TS1009: Trailing comma not allowed.

View file

@ -0,0 +1,92 @@
//// [tests/cases/conformance/importAssertion/importAssertion1.ts] ////
//// [0.ts]
export const a = 1;
export const b = 2;
//// [1.ts]
import './0' assert { type: "json" }
import { a, b } from './0' assert { "type": "json" }
import * as foo from './0' assert { type: "json" }
a;
b;
foo.a;
foo.b;
//// [2.ts]
import { a, b } from './0' assert {}
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
a;
b;
c;
d;
//// [3.ts]
const a = import('./0')
const b = import('./0', { assert: { type: "json" } })
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
const d = import('./0', { assert: {} })
const dd = import('./0', {})
declare function foo(): any;
const e = import('./0', foo())
const f = import()
const g = import('./0', {}, {})
const h = import('./0', { assert: { type: "json" }},)
//// [0.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.b = exports.a = void 0;
exports.a = 1;
exports.b = 2;
//// [1.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("./0");
const _0_1 = require("./0");
const foo = require("./0");
_0_1.a;
_0_1.b;
foo.a;
foo.b;
//// [2.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const _0_1 = require("./0");
const _0_2 = require("./0");
_0_1.a;
_0_1.b;
_0_2.a;
_0_2.b;
//// [3.js]
const a = Promise.resolve().then(() => require('./0'));
const b = Promise.resolve().then(() => require('./0'));
const c = Promise.resolve().then(() => require('./0'));
const d = Promise.resolve().then(() => require('./0'));
const dd = Promise.resolve().then(() => require('./0'));
const e = Promise.resolve().then(() => require('./0'));
const f = Promise.resolve().then(() => require());
const g = Promise.resolve().then(() => require('./0'));
const h = Promise.resolve().then(() => require('./0'));
//// [0.d.ts]
export declare const a = 1;
export declare const b = 2;
//// [1.d.ts]
import './0';
//// [2.d.ts]
export {};
//// [3.d.ts]
declare const a: Promise<typeof import("./0")>;
declare const b: Promise<typeof import("./0")>;
declare const c: Promise<typeof import("./0")>;
declare const d: Promise<typeof import("./0")>;
declare const dd: Promise<typeof import("./0")>;
declare function foo(): any;
declare const e: Promise<typeof import("./0")>;
declare const f: Promise<any>;
declare const g: Promise<typeof import("./0")>;
declare const h: Promise<typeof import("./0")>;

View file

@ -0,0 +1,104 @@
=== tests/cases/conformance/importAssertion/0.ts ===
export const a = 1;
>a : Symbol(a, Decl(0.ts, 0, 12))
export const b = 2;
>b : Symbol(b, Decl(0.ts, 1, 12))
=== tests/cases/conformance/importAssertion/1.ts ===
import './0' assert { type: "json" }
import { a, b } from './0' assert { "type": "json" }
>a : Symbol(a, Decl(1.ts, 1, 8))
>b : Symbol(b, Decl(1.ts, 1, 11))
import * as foo from './0' assert { type: "json" }
>foo : Symbol(foo, Decl(1.ts, 2, 6))
a;
>a : Symbol(a, Decl(1.ts, 1, 8))
b;
>b : Symbol(b, Decl(1.ts, 1, 11))
foo.a;
>foo.a : Symbol(a, Decl(0.ts, 0, 12))
>foo : Symbol(foo, Decl(1.ts, 2, 6))
>a : Symbol(a, Decl(0.ts, 0, 12))
foo.b;
>foo.b : Symbol(b, Decl(0.ts, 1, 12))
>foo : Symbol(foo, Decl(1.ts, 2, 6))
>b : Symbol(b, Decl(0.ts, 1, 12))
=== tests/cases/conformance/importAssertion/2.ts ===
import { a, b } from './0' assert {}
>a : Symbol(a, Decl(2.ts, 0, 8))
>b : Symbol(b, Decl(2.ts, 0, 11))
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
>a : Symbol(a, Decl(0.ts, 0, 12))
>c : Symbol(c, Decl(2.ts, 1, 8))
>b : Symbol(b, Decl(0.ts, 1, 12))
>d : Symbol(d, Decl(2.ts, 1, 16))
a;
>a : Symbol(a, Decl(2.ts, 0, 8))
b;
>b : Symbol(b, Decl(2.ts, 0, 11))
c;
>c : Symbol(c, Decl(2.ts, 1, 8))
d;
>d : Symbol(d, Decl(2.ts, 1, 16))
=== tests/cases/conformance/importAssertion/3.ts ===
const a = import('./0')
>a : Symbol(a, Decl(3.ts, 0, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
const b = import('./0', { assert: { type: "json" } })
>b : Symbol(b, Decl(3.ts, 1, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
>assert : Symbol(assert, Decl(3.ts, 1, 25))
>type : Symbol(type, Decl(3.ts, 1, 35))
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
>c : Symbol(c, Decl(3.ts, 2, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
>assert : Symbol(assert, Decl(3.ts, 2, 25))
>type : Symbol(type, Decl(3.ts, 2, 35))
>ttype : Symbol(ttype, Decl(3.ts, 2, 49))
const d = import('./0', { assert: {} })
>d : Symbol(d, Decl(3.ts, 3, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
>assert : Symbol(assert, Decl(3.ts, 3, 25))
const dd = import('./0', {})
>dd : Symbol(dd, Decl(3.ts, 4, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
declare function foo(): any;
>foo : Symbol(foo, Decl(3.ts, 4, 28))
const e = import('./0', foo())
>e : Symbol(e, Decl(3.ts, 6, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
>foo : Symbol(foo, Decl(3.ts, 4, 28))
const f = import()
>f : Symbol(f, Decl(3.ts, 7, 5))
const g = import('./0', {}, {})
>g : Symbol(g, Decl(3.ts, 8, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
const h = import('./0', { assert: { type: "json" }},)
>h : Symbol(h, Decl(3.ts, 9, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
>assert : Symbol(assert, Decl(3.ts, 9, 25))
>type : Symbol(type, Decl(3.ts, 9, 35))

View file

@ -0,0 +1,137 @@
=== tests/cases/conformance/importAssertion/0.ts ===
export const a = 1;
>a : 1
>1 : 1
export const b = 2;
>b : 2
>2 : 2
=== tests/cases/conformance/importAssertion/1.ts ===
import './0' assert { type: "json" }
>type : any
import { a, b } from './0' assert { "type": "json" }
>a : 1
>b : 2
import * as foo from './0' assert { type: "json" }
>foo : typeof foo
>type : any
a;
>a : 1
b;
>b : 2
foo.a;
>foo.a : 1
>foo : typeof foo
>a : 1
foo.b;
>foo.b : 2
>foo : typeof foo
>b : 2
=== tests/cases/conformance/importAssertion/2.ts ===
import { a, b } from './0' assert {}
>a : 1
>b : 2
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
>a : 1
>c : 1
>b : 2
>d : 2
>a : any
>b : any
>c : any
a;
>a : 1
b;
>b : 2
c;
>c : 1
d;
>d : 2
=== tests/cases/conformance/importAssertion/3.ts ===
const a = import('./0')
>a : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0') : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
const b = import('./0', { assert: { type: "json" } })
>b : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', { assert: { type: "json" } }) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{ assert: { type: "json" } } : { assert: { type: string; }; }
>assert : { type: string; }
>{ type: "json" } : { type: string; }
>type : string
>"json" : "json"
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
>c : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', { assert: { type: "json", ttype: "typo" } }) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{ assert: { type: "json", ttype: "typo" } } : { assert: { type: string; ttype: string; }; }
>assert : { type: string; ttype: string; }
>{ type: "json", ttype: "typo" } : { type: string; ttype: string; }
>type : string
>"json" : "json"
>ttype : string
>"typo" : "typo"
const d = import('./0', { assert: {} })
>d : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', { assert: {} }) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{ assert: {} } : { assert: {}; }
>assert : {}
>{} : {}
const dd = import('./0', {})
>dd : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', {}) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{} : {}
declare function foo(): any;
>foo : () => any
const e = import('./0', foo())
>e : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', foo()) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>foo() : any
>foo : () => any
const f = import()
>f : Promise<any>
>import() : Promise<any>
const g = import('./0', {}, {})
>g : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', {}, {}) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{} : {}
>{} : {}
const h = import('./0', { assert: { type: "json" }},)
>h : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', { assert: { type: "json" }},) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{ assert: { type: "json" }} : { assert: { type: string; }; }
>assert : { type: string; }
>{ type: "json" } : { type: string; }
>type : string
>"json" : "json"

View file

@ -0,0 +1,78 @@
tests/cases/conformance/importAssertion/1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/3.ts(1,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
tests/cases/conformance/importAssertion/3.ts(2,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
tests/cases/conformance/importAssertion/3.ts(3,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
tests/cases/conformance/importAssertion/3.ts(4,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
tests/cases/conformance/importAssertion/3.ts(5,12): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
tests/cases/conformance/importAssertion/3.ts(7,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
tests/cases/conformance/importAssertion/3.ts(8,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
tests/cases/conformance/importAssertion/3.ts(9,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
tests/cases/conformance/importAssertion/3.ts(10,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
==== tests/cases/conformance/importAssertion/0.ts (0 errors) ====
export const a = 1;
export const b = 2;
==== tests/cases/conformance/importAssertion/1.ts (3 errors) ====
import './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
import { a, b } from './0' assert { "type": "json" }
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
import * as foo from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
a;
b;
foo.a;
foo.b;
==== tests/cases/conformance/importAssertion/2.ts (2 errors) ====
import { a, b } from './0' assert {}
~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
a;
b;
c;
d;
==== tests/cases/conformance/importAssertion/3.ts (9 errors) ====
const a = import('./0')
~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
const b = import('./0', { assert: { type: "json" } })
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
const d = import('./0', { assert: {} })
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
const dd = import('./0', {})
~~~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
declare function foo(): any;
const e = import('./0', foo())
~~~~~~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
const f = import()
~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
const g = import('./0', {}, {})
~~~~~~~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
const h = import('./0', { assert: { type: "json" }},)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.

View file

@ -0,0 +1,85 @@
//// [tests/cases/conformance/importAssertion/importAssertion1.ts] ////
//// [0.ts]
export const a = 1;
export const b = 2;
//// [1.ts]
import './0' assert { type: "json" }
import { a, b } from './0' assert { "type": "json" }
import * as foo from './0' assert { type: "json" }
a;
b;
foo.a;
foo.b;
//// [2.ts]
import { a, b } from './0' assert {}
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
a;
b;
c;
d;
//// [3.ts]
const a = import('./0')
const b = import('./0', { assert: { type: "json" } })
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
const d = import('./0', { assert: {} })
const dd = import('./0', {})
declare function foo(): any;
const e = import('./0', foo())
const f = import()
const g = import('./0', {}, {})
const h = import('./0', { assert: { type: "json" }},)
//// [0.js]
export const a = 1;
export const b = 2;
//// [1.js]
import './0' assert { type: "json" };
import { a, b } from './0' assert { "type": "json" };
import * as foo from './0' assert { type: "json" };
a;
b;
foo.a;
foo.b;
//// [2.js]
import { a, b } from './0' assert {};
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" };
a;
b;
c;
d;
//// [3.js]
const a = import('./0');
const b = import('./0', { assert: { type: "json" } });
const c = import('./0', { assert: { type: "json", ttype: "typo" } });
const d = import('./0', { assert: {} });
const dd = import('./0', {});
const e = import('./0', foo());
const f = import();
const g = import('./0', {}, {});
const h = import('./0', { assert: { type: "json" } });
//// [0.d.ts]
export declare const a = 1;
export declare const b = 2;
//// [1.d.ts]
import './0';
//// [2.d.ts]
export {};
//// [3.d.ts]
declare const a: Promise<typeof import("./0")>;
declare const b: Promise<typeof import("./0")>;
declare const c: Promise<typeof import("./0")>;
declare const d: Promise<typeof import("./0")>;
declare const dd: Promise<typeof import("./0")>;
declare function foo(): any;
declare const e: Promise<typeof import("./0")>;
declare const f: Promise<any>;
declare const g: Promise<typeof import("./0")>;
declare const h: Promise<typeof import("./0")>;

View file

@ -0,0 +1,104 @@
=== tests/cases/conformance/importAssertion/0.ts ===
export const a = 1;
>a : Symbol(a, Decl(0.ts, 0, 12))
export const b = 2;
>b : Symbol(b, Decl(0.ts, 1, 12))
=== tests/cases/conformance/importAssertion/1.ts ===
import './0' assert { type: "json" }
import { a, b } from './0' assert { "type": "json" }
>a : Symbol(a, Decl(1.ts, 1, 8))
>b : Symbol(b, Decl(1.ts, 1, 11))
import * as foo from './0' assert { type: "json" }
>foo : Symbol(foo, Decl(1.ts, 2, 6))
a;
>a : Symbol(a, Decl(1.ts, 1, 8))
b;
>b : Symbol(b, Decl(1.ts, 1, 11))
foo.a;
>foo.a : Symbol(a, Decl(0.ts, 0, 12))
>foo : Symbol(foo, Decl(1.ts, 2, 6))
>a : Symbol(a, Decl(0.ts, 0, 12))
foo.b;
>foo.b : Symbol(b, Decl(0.ts, 1, 12))
>foo : Symbol(foo, Decl(1.ts, 2, 6))
>b : Symbol(b, Decl(0.ts, 1, 12))
=== tests/cases/conformance/importAssertion/2.ts ===
import { a, b } from './0' assert {}
>a : Symbol(a, Decl(2.ts, 0, 8))
>b : Symbol(b, Decl(2.ts, 0, 11))
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
>a : Symbol(a, Decl(0.ts, 0, 12))
>c : Symbol(c, Decl(2.ts, 1, 8))
>b : Symbol(b, Decl(0.ts, 1, 12))
>d : Symbol(d, Decl(2.ts, 1, 16))
a;
>a : Symbol(a, Decl(2.ts, 0, 8))
b;
>b : Symbol(b, Decl(2.ts, 0, 11))
c;
>c : Symbol(c, Decl(2.ts, 1, 8))
d;
>d : Symbol(d, Decl(2.ts, 1, 16))
=== tests/cases/conformance/importAssertion/3.ts ===
const a = import('./0')
>a : Symbol(a, Decl(3.ts, 0, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
const b = import('./0', { assert: { type: "json" } })
>b : Symbol(b, Decl(3.ts, 1, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
>assert : Symbol(assert, Decl(3.ts, 1, 25))
>type : Symbol(type, Decl(3.ts, 1, 35))
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
>c : Symbol(c, Decl(3.ts, 2, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
>assert : Symbol(assert, Decl(3.ts, 2, 25))
>type : Symbol(type, Decl(3.ts, 2, 35))
>ttype : Symbol(ttype, Decl(3.ts, 2, 49))
const d = import('./0', { assert: {} })
>d : Symbol(d, Decl(3.ts, 3, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
>assert : Symbol(assert, Decl(3.ts, 3, 25))
const dd = import('./0', {})
>dd : Symbol(dd, Decl(3.ts, 4, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
declare function foo(): any;
>foo : Symbol(foo, Decl(3.ts, 4, 28))
const e = import('./0', foo())
>e : Symbol(e, Decl(3.ts, 6, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
>foo : Symbol(foo, Decl(3.ts, 4, 28))
const f = import()
>f : Symbol(f, Decl(3.ts, 7, 5))
const g = import('./0', {}, {})
>g : Symbol(g, Decl(3.ts, 8, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
const h = import('./0', { assert: { type: "json" }},)
>h : Symbol(h, Decl(3.ts, 9, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
>assert : Symbol(assert, Decl(3.ts, 9, 25))
>type : Symbol(type, Decl(3.ts, 9, 35))

View file

@ -0,0 +1,137 @@
=== tests/cases/conformance/importAssertion/0.ts ===
export const a = 1;
>a : 1
>1 : 1
export const b = 2;
>b : 2
>2 : 2
=== tests/cases/conformance/importAssertion/1.ts ===
import './0' assert { type: "json" }
>type : any
import { a, b } from './0' assert { "type": "json" }
>a : 1
>b : 2
import * as foo from './0' assert { type: "json" }
>foo : typeof foo
>type : any
a;
>a : 1
b;
>b : 2
foo.a;
>foo.a : 1
>foo : typeof foo
>a : 1
foo.b;
>foo.b : 2
>foo : typeof foo
>b : 2
=== tests/cases/conformance/importAssertion/2.ts ===
import { a, b } from './0' assert {}
>a : 1
>b : 2
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
>a : 1
>c : 1
>b : 2
>d : 2
>a : any
>b : any
>c : any
a;
>a : 1
b;
>b : 2
c;
>c : 1
d;
>d : 2
=== tests/cases/conformance/importAssertion/3.ts ===
const a = import('./0')
>a : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0') : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
const b = import('./0', { assert: { type: "json" } })
>b : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', { assert: { type: "json" } }) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{ assert: { type: "json" } } : { assert: { type: string; }; }
>assert : { type: string; }
>{ type: "json" } : { type: string; }
>type : string
>"json" : "json"
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
>c : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', { assert: { type: "json", ttype: "typo" } }) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{ assert: { type: "json", ttype: "typo" } } : { assert: { type: string; ttype: string; }; }
>assert : { type: string; ttype: string; }
>{ type: "json", ttype: "typo" } : { type: string; ttype: string; }
>type : string
>"json" : "json"
>ttype : string
>"typo" : "typo"
const d = import('./0', { assert: {} })
>d : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', { assert: {} }) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{ assert: {} } : { assert: {}; }
>assert : {}
>{} : {}
const dd = import('./0', {})
>dd : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', {}) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{} : {}
declare function foo(): any;
>foo : () => any
const e = import('./0', foo())
>e : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', foo()) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>foo() : any
>foo : () => any
const f = import()
>f : Promise<any>
>import() : Promise<any>
const g = import('./0', {}, {})
>g : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', {}, {}) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{} : {}
>{} : {}
const h = import('./0', { assert: { type: "json" }},)
>h : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', { assert: { type: "json" }},) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{ assert: { type: "json" }} : { assert: { type: string; }; }
>assert : { type: string; }
>{ type: "json" } : { type: string; }
>type : string
>"json" : "json"

View file

@ -0,0 +1,42 @@
tests/cases/conformance/importAssertion/3.ts(8,11): message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments
tests/cases/conformance/importAssertion/3.ts(9,11): message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments
==== tests/cases/conformance/importAssertion/0.ts (0 errors) ====
export const a = 1;
export const b = 2;
==== tests/cases/conformance/importAssertion/1.ts (0 errors) ====
import './0' assert { type: "json" }
import { a, b } from './0' assert { "type": "json" }
import * as foo from './0' assert { type: "json" }
a;
b;
foo.a;
foo.b;
==== tests/cases/conformance/importAssertion/2.ts (0 errors) ====
import { a, b } from './0' assert {}
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
a;
b;
c;
d;
==== tests/cases/conformance/importAssertion/3.ts (2 errors) ====
const a = import('./0')
const b = import('./0', { assert: { type: "json" } })
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
const d = import('./0', { assert: {} })
const dd = import('./0', {})
declare function foo(): any;
const e = import('./0', foo())
const f = import()
~~~~~~~~
!!! message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments
const g = import('./0', {}, {})
~~~~~~~~~~~~~~~~~~~~~
!!! message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments
const h = import('./0', { assert: { type: "json" }},)

View file

@ -0,0 +1,85 @@
//// [tests/cases/conformance/importAssertion/importAssertion1.ts] ////
//// [0.ts]
export const a = 1;
export const b = 2;
//// [1.ts]
import './0' assert { type: "json" }
import { a, b } from './0' assert { "type": "json" }
import * as foo from './0' assert { type: "json" }
a;
b;
foo.a;
foo.b;
//// [2.ts]
import { a, b } from './0' assert {}
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
a;
b;
c;
d;
//// [3.ts]
const a = import('./0')
const b = import('./0', { assert: { type: "json" } })
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
const d = import('./0', { assert: {} })
const dd = import('./0', {})
declare function foo(): any;
const e = import('./0', foo())
const f = import()
const g = import('./0', {}, {})
const h = import('./0', { assert: { type: "json" }},)
//// [0.js]
export const a = 1;
export const b = 2;
//// [1.js]
import './0' assert { type: "json" };
import { a, b } from './0' assert { "type": "json" };
import * as foo from './0' assert { type: "json" };
a;
b;
foo.a;
foo.b;
//// [2.js]
import { a, b } from './0' assert {};
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" };
a;
b;
c;
d;
//// [3.js]
const a = import('./0');
const b = import('./0', { assert: { type: "json" } });
const c = import('./0', { assert: { type: "json", ttype: "typo" } });
const d = import('./0', { assert: {} });
const dd = import('./0', {});
const e = import('./0', foo());
const f = import();
const g = import('./0', {}, {});
const h = import('./0', { assert: { type: "json" } });
//// [0.d.ts]
export declare const a = 1;
export declare const b = 2;
//// [1.d.ts]
import './0';
//// [2.d.ts]
export {};
//// [3.d.ts]
declare const a: Promise<typeof import("./0")>;
declare const b: Promise<typeof import("./0")>;
declare const c: Promise<typeof import("./0")>;
declare const d: Promise<typeof import("./0")>;
declare const dd: Promise<typeof import("./0")>;
declare function foo(): any;
declare const e: Promise<typeof import("./0")>;
declare const f: Promise<any>;
declare const g: Promise<typeof import("./0")>;
declare const h: Promise<typeof import("./0")>;

View file

@ -0,0 +1,104 @@
=== tests/cases/conformance/importAssertion/0.ts ===
export const a = 1;
>a : Symbol(a, Decl(0.ts, 0, 12))
export const b = 2;
>b : Symbol(b, Decl(0.ts, 1, 12))
=== tests/cases/conformance/importAssertion/1.ts ===
import './0' assert { type: "json" }
import { a, b } from './0' assert { "type": "json" }
>a : Symbol(a, Decl(1.ts, 1, 8))
>b : Symbol(b, Decl(1.ts, 1, 11))
import * as foo from './0' assert { type: "json" }
>foo : Symbol(foo, Decl(1.ts, 2, 6))
a;
>a : Symbol(a, Decl(1.ts, 1, 8))
b;
>b : Symbol(b, Decl(1.ts, 1, 11))
foo.a;
>foo.a : Symbol(a, Decl(0.ts, 0, 12))
>foo : Symbol(foo, Decl(1.ts, 2, 6))
>a : Symbol(a, Decl(0.ts, 0, 12))
foo.b;
>foo.b : Symbol(b, Decl(0.ts, 1, 12))
>foo : Symbol(foo, Decl(1.ts, 2, 6))
>b : Symbol(b, Decl(0.ts, 1, 12))
=== tests/cases/conformance/importAssertion/2.ts ===
import { a, b } from './0' assert {}
>a : Symbol(a, Decl(2.ts, 0, 8))
>b : Symbol(b, Decl(2.ts, 0, 11))
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
>a : Symbol(a, Decl(0.ts, 0, 12))
>c : Symbol(c, Decl(2.ts, 1, 8))
>b : Symbol(b, Decl(0.ts, 1, 12))
>d : Symbol(d, Decl(2.ts, 1, 16))
a;
>a : Symbol(a, Decl(2.ts, 0, 8))
b;
>b : Symbol(b, Decl(2.ts, 0, 11))
c;
>c : Symbol(c, Decl(2.ts, 1, 8))
d;
>d : Symbol(d, Decl(2.ts, 1, 16))
=== tests/cases/conformance/importAssertion/3.ts ===
const a = import('./0')
>a : Symbol(a, Decl(3.ts, 0, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
const b = import('./0', { assert: { type: "json" } })
>b : Symbol(b, Decl(3.ts, 1, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
>assert : Symbol(assert, Decl(3.ts, 1, 25))
>type : Symbol(type, Decl(3.ts, 1, 35))
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
>c : Symbol(c, Decl(3.ts, 2, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
>assert : Symbol(assert, Decl(3.ts, 2, 25))
>type : Symbol(type, Decl(3.ts, 2, 35))
>ttype : Symbol(ttype, Decl(3.ts, 2, 49))
const d = import('./0', { assert: {} })
>d : Symbol(d, Decl(3.ts, 3, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
>assert : Symbol(assert, Decl(3.ts, 3, 25))
const dd = import('./0', {})
>dd : Symbol(dd, Decl(3.ts, 4, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
declare function foo(): any;
>foo : Symbol(foo, Decl(3.ts, 4, 28))
const e = import('./0', foo())
>e : Symbol(e, Decl(3.ts, 6, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
>foo : Symbol(foo, Decl(3.ts, 4, 28))
const f = import()
>f : Symbol(f, Decl(3.ts, 7, 5))
const g = import('./0', {}, {})
>g : Symbol(g, Decl(3.ts, 8, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
const h = import('./0', { assert: { type: "json" }},)
>h : Symbol(h, Decl(3.ts, 9, 5))
>'./0' : Symbol("tests/cases/conformance/importAssertion/0", Decl(0.ts, 0, 0))
>assert : Symbol(assert, Decl(3.ts, 9, 25))
>type : Symbol(type, Decl(3.ts, 9, 35))

View file

@ -0,0 +1,137 @@
=== tests/cases/conformance/importAssertion/0.ts ===
export const a = 1;
>a : 1
>1 : 1
export const b = 2;
>b : 2
>2 : 2
=== tests/cases/conformance/importAssertion/1.ts ===
import './0' assert { type: "json" }
>type : any
import { a, b } from './0' assert { "type": "json" }
>a : 1
>b : 2
import * as foo from './0' assert { type: "json" }
>foo : typeof foo
>type : any
a;
>a : 1
b;
>b : 2
foo.a;
>foo.a : 1
>foo : typeof foo
>a : 1
foo.b;
>foo.b : 2
>foo : typeof foo
>b : 2
=== tests/cases/conformance/importAssertion/2.ts ===
import { a, b } from './0' assert {}
>a : 1
>b : 2
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
>a : 1
>c : 1
>b : 2
>d : 2
>a : any
>b : any
>c : any
a;
>a : 1
b;
>b : 2
c;
>c : 1
d;
>d : 2
=== tests/cases/conformance/importAssertion/3.ts ===
const a = import('./0')
>a : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0') : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
const b = import('./0', { assert: { type: "json" } })
>b : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', { assert: { type: "json" } }) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{ assert: { type: "json" } } : { assert: { type: string; }; }
>assert : { type: string; }
>{ type: "json" } : { type: string; }
>type : string
>"json" : "json"
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
>c : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', { assert: { type: "json", ttype: "typo" } }) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{ assert: { type: "json", ttype: "typo" } } : { assert: { type: string; ttype: string; }; }
>assert : { type: string; ttype: string; }
>{ type: "json", ttype: "typo" } : { type: string; ttype: string; }
>type : string
>"json" : "json"
>ttype : string
>"typo" : "typo"
const d = import('./0', { assert: {} })
>d : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', { assert: {} }) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{ assert: {} } : { assert: {}; }
>assert : {}
>{} : {}
const dd = import('./0', {})
>dd : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', {}) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{} : {}
declare function foo(): any;
>foo : () => any
const e = import('./0', foo())
>e : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', foo()) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>foo() : any
>foo : () => any
const f = import()
>f : Promise<any>
>import() : Promise<any>
const g = import('./0', {}, {})
>g : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', {}, {}) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{} : {}
>{} : {}
const h = import('./0', { assert: { type: "json" }},)
>h : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>import('./0', { assert: { type: "json" }},) : Promise<typeof import("tests/cases/conformance/importAssertion/0")>
>'./0' : "./0"
>{ assert: { type: "json" }} : { assert: { type: string; }; }
>assert : { type: string; }
>{ type: "json" } : { type: string; }
>type : string
>"json" : "json"

View file

@ -0,0 +1,34 @@
tests/cases/conformance/importAssertion/1.ts(1,22): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
==== tests/cases/conformance/importAssertion/0.ts (0 errors) ====
export const a = 1;
export const b = 2;
==== tests/cases/conformance/importAssertion/1.ts (4 errors) ====
export {} from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
export { a, b } from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
export * from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
export * as ns from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
==== tests/cases/conformance/importAssertion/2.ts (2 errors) ====
export { a, b } from './0' assert {}
~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.

View file

@ -0,0 +1,65 @@
//// [tests/cases/conformance/importAssertion/importAssertion2.ts] ////
//// [0.ts]
export const a = 1;
export const b = 2;
//// [1.ts]
export {} from './0' assert { type: "json" }
export { a, b } from './0' assert { type: "json" }
export * from './0' assert { type: "json" }
export * as ns from './0' assert { type: "json" }
//// [2.ts]
export { a, b } from './0' assert {}
export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
//// [0.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.b = exports.a = void 0;
exports.a = 1;
exports.b = 2;
//// [1.js]
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ns = exports.b = exports.a = void 0;
var _0_1 = require("./0");
Object.defineProperty(exports, "a", { enumerable: true, get: function () { return _0_1.a; } });
Object.defineProperty(exports, "b", { enumerable: true, get: function () { return _0_1.b; } });
__exportStar(require("./0"), exports);
exports.ns = require("./0");
//// [2.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.d = exports.c = exports.b = exports.a = void 0;
var _0_1 = require("./0");
Object.defineProperty(exports, "a", { enumerable: true, get: function () { return _0_1.a; } });
Object.defineProperty(exports, "b", { enumerable: true, get: function () { return _0_1.b; } });
var _0_2 = require("./0");
Object.defineProperty(exports, "c", { enumerable: true, get: function () { return _0_2.a; } });
Object.defineProperty(exports, "d", { enumerable: true, get: function () { return _0_2.b; } });
//// [0.d.ts]
export declare const a = 1;
export declare const b = 2;
//// [1.d.ts]
export {} from './0';
export { a, b } from './0';
export * from './0';
export * as ns from './0';
//// [2.d.ts]
export { a, b } from './0';
export { a as c, b as d } from './0';

View file

@ -0,0 +1,28 @@
=== tests/cases/conformance/importAssertion/0.ts ===
export const a = 1;
>a : Symbol(a, Decl(0.ts, 0, 12))
export const b = 2;
>b : Symbol(b, Decl(0.ts, 1, 12))
=== tests/cases/conformance/importAssertion/1.ts ===
export {} from './0' assert { type: "json" }
export { a, b } from './0' assert { type: "json" }
>a : Symbol(a, Decl(1.ts, 1, 8))
>b : Symbol(b, Decl(1.ts, 1, 11))
export * from './0' assert { type: "json" }
export * as ns from './0' assert { type: "json" }
>ns : Symbol(ns, Decl(1.ts, 3, 6))
=== tests/cases/conformance/importAssertion/2.ts ===
export { a, b } from './0' assert {}
>a : Symbol(a, Decl(2.ts, 0, 8))
>b : Symbol(b, Decl(2.ts, 0, 11))
export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
>a : Symbol(a, Decl(0.ts, 0, 12))
>c : Symbol(c, Decl(2.ts, 1, 8))
>b : Symbol(b, Decl(0.ts, 1, 12))
>d : Symbol(d, Decl(2.ts, 1, 16))

View file

@ -0,0 +1,39 @@
=== tests/cases/conformance/importAssertion/0.ts ===
export const a = 1;
>a : 1
>1 : 1
export const b = 2;
>b : 2
>2 : 2
=== tests/cases/conformance/importAssertion/1.ts ===
export {} from './0' assert { type: "json" }
>type : any
export { a, b } from './0' assert { type: "json" }
>a : 1
>b : 2
>type : any
export * from './0' assert { type: "json" }
>type : any
export * as ns from './0' assert { type: "json" }
>ns : typeof import("tests/cases/conformance/importAssertion/0")
>type : any
=== tests/cases/conformance/importAssertion/2.ts ===
export { a, b } from './0' assert {}
>a : 1
>b : 2
export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
>a : 1
>c : 1
>b : 2
>d : 2
>a : any
>b : any
>c : any

View file

@ -0,0 +1,34 @@
tests/cases/conformance/importAssertion/1.ts(1,22): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
==== tests/cases/conformance/importAssertion/0.ts (0 errors) ====
export const a = 1;
export const b = 2;
==== tests/cases/conformance/importAssertion/1.ts (4 errors) ====
export {} from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
export { a, b } from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
export * from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
export * as ns from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
==== tests/cases/conformance/importAssertion/2.ts (2 errors) ====
export { a, b } from './0' assert {}
~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.

View file

@ -0,0 +1,41 @@
//// [tests/cases/conformance/importAssertion/importAssertion2.ts] ////
//// [0.ts]
export const a = 1;
export const b = 2;
//// [1.ts]
export {} from './0' assert { type: "json" }
export { a, b } from './0' assert { type: "json" }
export * from './0' assert { type: "json" }
export * as ns from './0' assert { type: "json" }
//// [2.ts]
export { a, b } from './0' assert {}
export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
//// [0.js]
export const a = 1;
export const b = 2;
//// [1.js]
export { a, b } from './0' assert { type: "json" };
export * from './0' assert { type: "json" };
import * as ns_1 from './0' assert { type: "json" };
export { ns_1 as ns };
//// [2.js]
export { a, b } from './0' assert {};
export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" };
//// [0.d.ts]
export declare const a = 1;
export declare const b = 2;
//// [1.d.ts]
export {} from './0';
export { a, b } from './0';
export * from './0';
export * as ns from './0';
//// [2.d.ts]
export { a, b } from './0';
export { a as c, b as d } from './0';

View file

@ -0,0 +1,28 @@
=== tests/cases/conformance/importAssertion/0.ts ===
export const a = 1;
>a : Symbol(a, Decl(0.ts, 0, 12))
export const b = 2;
>b : Symbol(b, Decl(0.ts, 1, 12))
=== tests/cases/conformance/importAssertion/1.ts ===
export {} from './0' assert { type: "json" }
export { a, b } from './0' assert { type: "json" }
>a : Symbol(a, Decl(1.ts, 1, 8))
>b : Symbol(b, Decl(1.ts, 1, 11))
export * from './0' assert { type: "json" }
export * as ns from './0' assert { type: "json" }
>ns : Symbol(ns, Decl(1.ts, 3, 6))
=== tests/cases/conformance/importAssertion/2.ts ===
export { a, b } from './0' assert {}
>a : Symbol(a, Decl(2.ts, 0, 8))
>b : Symbol(b, Decl(2.ts, 0, 11))
export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
>a : Symbol(a, Decl(0.ts, 0, 12))
>c : Symbol(c, Decl(2.ts, 1, 8))
>b : Symbol(b, Decl(0.ts, 1, 12))
>d : Symbol(d, Decl(2.ts, 1, 16))

View file

@ -0,0 +1,39 @@
=== tests/cases/conformance/importAssertion/0.ts ===
export const a = 1;
>a : 1
>1 : 1
export const b = 2;
>b : 2
>2 : 2
=== tests/cases/conformance/importAssertion/1.ts ===
export {} from './0' assert { type: "json" }
>type : any
export { a, b } from './0' assert { type: "json" }
>a : 1
>b : 2
>type : any
export * from './0' assert { type: "json" }
>type : any
export * as ns from './0' assert { type: "json" }
>ns : typeof import("tests/cases/conformance/importAssertion/0")
>type : any
=== tests/cases/conformance/importAssertion/2.ts ===
export { a, b } from './0' assert {}
>a : 1
>b : 2
export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
>a : 1
>c : 1
>b : 2
>d : 2
>a : any
>b : any
>c : any

View file

@ -0,0 +1,40 @@
//// [tests/cases/conformance/importAssertion/importAssertion2.ts] ////
//// [0.ts]
export const a = 1;
export const b = 2;
//// [1.ts]
export {} from './0' assert { type: "json" }
export { a, b } from './0' assert { type: "json" }
export * from './0' assert { type: "json" }
export * as ns from './0' assert { type: "json" }
//// [2.ts]
export { a, b } from './0' assert {}
export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
//// [0.js]
export const a = 1;
export const b = 2;
//// [1.js]
export { a, b } from './0' assert { type: "json" };
export * from './0' assert { type: "json" };
export * as ns from './0' assert { type: "json" };
//// [2.js]
export { a, b } from './0' assert {};
export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" };
//// [0.d.ts]
export declare const a = 1;
export declare const b = 2;
//// [1.d.ts]
export {} from './0';
export { a, b } from './0';
export * from './0';
export * as ns from './0';
//// [2.d.ts]
export { a, b } from './0';
export { a as c, b as d } from './0';

View file

@ -0,0 +1,28 @@
=== tests/cases/conformance/importAssertion/0.ts ===
export const a = 1;
>a : Symbol(a, Decl(0.ts, 0, 12))
export const b = 2;
>b : Symbol(b, Decl(0.ts, 1, 12))
=== tests/cases/conformance/importAssertion/1.ts ===
export {} from './0' assert { type: "json" }
export { a, b } from './0' assert { type: "json" }
>a : Symbol(a, Decl(1.ts, 1, 8))
>b : Symbol(b, Decl(1.ts, 1, 11))
export * from './0' assert { type: "json" }
export * as ns from './0' assert { type: "json" }
>ns : Symbol(ns, Decl(1.ts, 3, 6))
=== tests/cases/conformance/importAssertion/2.ts ===
export { a, b } from './0' assert {}
>a : Symbol(a, Decl(2.ts, 0, 8))
>b : Symbol(b, Decl(2.ts, 0, 11))
export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
>a : Symbol(a, Decl(0.ts, 0, 12))
>c : Symbol(c, Decl(2.ts, 1, 8))
>b : Symbol(b, Decl(0.ts, 1, 12))
>d : Symbol(d, Decl(2.ts, 1, 16))

View file

@ -0,0 +1,39 @@
=== tests/cases/conformance/importAssertion/0.ts ===
export const a = 1;
>a : 1
>1 : 1
export const b = 2;
>b : 2
>2 : 2
=== tests/cases/conformance/importAssertion/1.ts ===
export {} from './0' assert { type: "json" }
>type : error
export { a, b } from './0' assert { type: "json" }
>a : 1
>b : 2
>type : error
export * from './0' assert { type: "json" }
>type : error
export * as ns from './0' assert { type: "json" }
>ns : typeof import("tests/cases/conformance/importAssertion/0")
>type : error
=== tests/cases/conformance/importAssertion/2.ts ===
export { a, b } from './0' assert {}
>a : 1
>b : 2
export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
>a : 1
>c : 1
>b : 2
>d : 2
>a : error
>b : error
>c : error

View file

@ -0,0 +1,26 @@
tests/cases/conformance/importAssertion/1.ts(1,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/1.ts(2,30): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/2.ts(1,31): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/2.ts(2,33): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
==== tests/cases/conformance/importAssertion/0.ts (0 errors) ====
export interface I { }
==== tests/cases/conformance/importAssertion/1.ts (2 errors) ====
export type {} from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
export type { I } from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
==== tests/cases/conformance/importAssertion/2.ts (2 errors) ====
import type { I } from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
import type * as foo from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.

View file

@ -0,0 +1,31 @@
//// [tests/cases/conformance/importAssertion/importAssertion3.ts] ////
//// [0.ts]
export interface I { }
//// [1.ts]
export type {} from './0' assert { type: "json" }
export type { I } from './0' assert { type: "json" }
//// [2.ts]
import type { I } from './0' assert { type: "json" }
import type * as foo from './0' assert { type: "json" }
//// [0.js]
export {};
//// [1.js]
export {};
//// [2.js]
export {};
//// [0.d.ts]
export interface I {
}
//// [1.d.ts]
export type {} from './0';
export type { I } from './0';
//// [2.d.ts]
export {};

View file

@ -0,0 +1,17 @@
=== tests/cases/conformance/importAssertion/0.ts ===
export interface I { }
>I : Symbol(I, Decl(0.ts, 0, 0))
=== tests/cases/conformance/importAssertion/1.ts ===
export type {} from './0' assert { type: "json" }
export type { I } from './0' assert { type: "json" }
>I : Symbol(I, Decl(1.ts, 1, 13))
=== tests/cases/conformance/importAssertion/2.ts ===
import type { I } from './0' assert { type: "json" }
>I : Symbol(I, Decl(2.ts, 0, 13))
import type * as foo from './0' assert { type: "json" }
>foo : Symbol(foo, Decl(2.ts, 1, 11))

View file

@ -0,0 +1,21 @@
=== tests/cases/conformance/importAssertion/0.ts ===
export interface I { }
No type information for this code.
No type information for this code.=== tests/cases/conformance/importAssertion/1.ts ===
export type {} from './0' assert { type: "json" }
>type : any
export type { I } from './0' assert { type: "json" }
>I : import("tests/cases/conformance/importAssertion/0").I
>type : any
=== tests/cases/conformance/importAssertion/2.ts ===
import type { I } from './0' assert { type: "json" }
>I : I
>type : any
import type * as foo from './0' assert { type: "json" }
>foo : typeof foo
>type : any

View file

@ -0,0 +1,26 @@
tests/cases/conformance/importAssertion/1.ts(1,27): error TS2822: Import assertions cannot be used with type-only imports or exports.
tests/cases/conformance/importAssertion/1.ts(2,30): error TS2822: Import assertions cannot be used with type-only imports or exports.
tests/cases/conformance/importAssertion/2.ts(1,31): error TS2822: Import assertions cannot be used with type-only imports or exports.
tests/cases/conformance/importAssertion/2.ts(2,33): error TS2822: Import assertions cannot be used with type-only imports or exports.
==== tests/cases/conformance/importAssertion/0.ts (0 errors) ====
export interface I { }
==== tests/cases/conformance/importAssertion/1.ts (2 errors) ====
export type {} from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2822: Import assertions cannot be used with type-only imports or exports.
export type { I } from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2822: Import assertions cannot be used with type-only imports or exports.
==== tests/cases/conformance/importAssertion/2.ts (2 errors) ====
import type { I } from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2822: Import assertions cannot be used with type-only imports or exports.
import type * as foo from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2822: Import assertions cannot be used with type-only imports or exports.

View file

@ -0,0 +1,31 @@
//// [tests/cases/conformance/importAssertion/importAssertion3.ts] ////
//// [0.ts]
export interface I { }
//// [1.ts]
export type {} from './0' assert { type: "json" }
export type { I } from './0' assert { type: "json" }
//// [2.ts]
import type { I } from './0' assert { type: "json" }
import type * as foo from './0' assert { type: "json" }
//// [0.js]
export {};
//// [1.js]
export {};
//// [2.js]
export {};
//// [0.d.ts]
export interface I {
}
//// [1.d.ts]
export type {} from './0';
export type { I } from './0';
//// [2.d.ts]
export {};

View file

@ -0,0 +1,17 @@
=== tests/cases/conformance/importAssertion/0.ts ===
export interface I { }
>I : Symbol(I, Decl(0.ts, 0, 0))
=== tests/cases/conformance/importAssertion/1.ts ===
export type {} from './0' assert { type: "json" }
export type { I } from './0' assert { type: "json" }
>I : Symbol(I, Decl(1.ts, 1, 13))
=== tests/cases/conformance/importAssertion/2.ts ===
import type { I } from './0' assert { type: "json" }
>I : Symbol(I, Decl(2.ts, 0, 13))
import type * as foo from './0' assert { type: "json" }
>foo : Symbol(foo, Decl(2.ts, 1, 11))

View file

@ -0,0 +1,21 @@
=== tests/cases/conformance/importAssertion/0.ts ===
export interface I { }
No type information for this code.
No type information for this code.=== tests/cases/conformance/importAssertion/1.ts ===
export type {} from './0' assert { type: "json" }
>type : any
export type { I } from './0' assert { type: "json" }
>I : import("tests/cases/conformance/importAssertion/0").I
>type : any
=== tests/cases/conformance/importAssertion/2.ts ===
import type { I } from './0' assert { type: "json" }
>I : I
>type : any
import type * as foo from './0' assert { type: "json" }
>foo : typeof foo
>type : any

View file

@ -1,27 +1,30 @@
tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(5,8): error TS1325: Specifier of dynamic import cannot be spread element.
tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(7,17): error TS1325: Specifier of dynamic import cannot be spread element.
tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(8,12): error TS1324: Dynamic import must have one specifier as an argument.
tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(9,12): error TS1324: Dynamic import must have one specifier as an argument.
tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(5,8): error TS1325: Argument of dynamic import cannot be spread element.
tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(7,17): error TS1325: Argument of dynamic import cannot be spread element.
tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(8,12): message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments
tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(9,19): error TS2307: Cannot find module 'pathToModule' or its corresponding type declarations.
tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(9,35): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(9,35): error TS2559: Type '"secondModule"' has no properties in common with type 'ImportCallOptions'.
==== tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts (5 errors) ====
==== tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts (6 errors) ====
declare function getSpecifier(): string;
declare var whatToLoad: boolean;
var a = ["./0"];
import(...["PathModule"]);
~~~~~~~~~~~~~~~~~
!!! error TS1325: Specifier of dynamic import cannot be spread element.
!!! error TS1325: Argument of dynamic import cannot be spread element.
var p1 = import(...a);
~~~~
!!! error TS1325: Specifier of dynamic import cannot be spread element.
!!! error TS1325: Argument of dynamic import cannot be spread element.
const p2 = import();
~~~~~~~~
!!! error TS1324: Dynamic import must have one specifier as an argument.
!!! message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments
const p4 = import("pathToModule", "secondModule");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1324: Dynamic import must have one specifier as an argument.
~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module 'pathToModule' or its corresponding type declarations.
!!! error TS2307: Cannot find module 'pathToModule' or its corresponding type declarations.
~~~~~~~~~~~~~~
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext'.
~~~~~~~~~~~~~~
!!! error TS2559: Type '"secondModule"' has no properties in common with type 'ImportCallOptions'.

View file

@ -7,5 +7,5 @@ tests/cases/compiler/mappedTypeWithAsClauseAndLateBoundProperty.ts(3,1): error T
tgt2 = src2; // Should error
~~~~
!!! error TS2741: Property 'length' is missing in type '{ [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; every: { <S extends number>(predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: <U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { <S extends number>(predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; <U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { <S extends number>(predicate: (this: void, value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator<number>; values: () => IterableIterator<number>; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: <U, This = undefined>(callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: <A, D extends number = 1>(this: A, depth?: D) => FlatArray<A, D>[]; [iterator]: () => IterableIterator<number>; [unscopables]: () => { copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: boolean; values: boolean; }; }' but required in type 'number[]'.
!!! related TS2728 /.ts/lib.es5.d.ts:1256:5: 'length' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1273:5: 'length' is declared here.

View file

@ -24,7 +24,7 @@ tests/cases/conformance/types/any/narrowExceptionVariableInCatchClause.ts(16,17)
err.massage; // ERROR: Property 'massage' does not exist on type 'Error'
~~~~~~~
!!! error TS2551: Property 'massage' does not exist on type 'Error'. Did you mean 'message'?
!!! related TS2728 /.ts/lib.es5.d.ts:1006:5: 'message' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1023:5: 'message' is declared here.
}
else {

View file

@ -22,7 +22,7 @@ tests/cases/conformance/types/any/narrowFromAnyWithInstanceof.ts(22,7): error TS
x.mesage;
~~~~~~
!!! error TS2551: Property 'mesage' does not exist on type 'Error'. Did you mean 'message'?
!!! related TS2728 /.ts/lib.es5.d.ts:1006:5: 'message' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1023:5: 'message' is declared here.
}
if (x instanceof Date) {
@ -30,6 +30,6 @@ tests/cases/conformance/types/any/narrowFromAnyWithInstanceof.ts(22,7): error TS
x.getHuors();
~~~~~~~~
!!! error TS2551: Property 'getHuors' does not exist on type 'Date'. Did you mean 'getHours'?
!!! related TS2728 /.ts/lib.es5.d.ts:766:5: 'getHours' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:783:5: 'getHours' is declared here.
}

View file

@ -41,7 +41,7 @@ tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(33,7): error
x.mesage;
~~~~~~
!!! error TS2551: Property 'mesage' does not exist on type 'Error'. Did you mean 'message'?
!!! related TS2728 /.ts/lib.es5.d.ts:1006:5: 'message' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1023:5: 'message' is declared here.
}
if (isDate(x)) {
@ -49,6 +49,6 @@ tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(33,7): error
x.getHuors();
~~~~~~~~
!!! error TS2551: Property 'getHuors' does not exist on type 'Date'. Did you mean 'getHours'?
!!! related TS2728 /.ts/lib.es5.d.ts:766:5: 'getHours' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:783:5: 'getHours' is declared here.
}

View file

@ -19,7 +19,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.2_A1.5_T2.ts(20,3): error TS
$ERROR('#1: eval("\\u00A0var x\\u00A0= 1\\u00A0"); x === 1. Actual: ' + (x));
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
//CHECK#2
@ -28,7 +28,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.2_A1.5_T2.ts(20,3): error TS
$ERROR('#2:  var x = 1 ; x === 1. Actual: ' + (x));
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}

View file

@ -21,7 +21,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.3_A1.1_T2.ts(17,3): error TS
$ERROR('#1: var\\nx\\n=\\n1\\n; x === 1. Actual: ' + (x));
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}

View file

@ -50,70 +50,70 @@ tests/cases/conformance/parser/ecmascript5/parserS7.6_A4.2_T1.ts(142,3): error T
$ERROR('#А');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0411 = 1;
if (Б !== 1) {
$ERROR('#Б');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0412 = 1;
if (В !== 1) {
$ERROR('#В');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0413 = 1;
if (Г !== 1) {
$ERROR('#Г');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0414 = 1;
if (Д !== 1) {
$ERROR('#Д');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0415 = 1;
if (Е !== 1) {
$ERROR('#Е');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0416 = 1;
if (Ж !== 1) {
$ERROR('#Ж');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0417 = 1;
if (З !== 1) {
$ERROR('#З');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0418 = 1;
if (И !== 1) {
$ERROR('#И');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0419 = 1;
if (Й !== 1) {
$ERROR('#Й');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u041A = 1;
if (К !== 1) {

View file

@ -11,13 +11,13 @@ tests/cases/conformance/parser/ecmascript5/parserUnicode1.ts(10,5): error TS2552
$ERROR('#6.1: var \\u0078x = 1; xx === 6. Actual: ' + (xx));
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
}
catch (e) {
$ERROR('#6.2: var \\u0078x = 1; xx === 6. Actual: ' + (xx));
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}

View file

@ -447,7 +447,7 @@ tests/cases/compiler/promisePermutations.ts(160,21): error TS2769: No overload m
!!! error TS2769: The last overload gave the following error.
!!! error TS2769: Argument of type '(x: any) => IPromise<string>' is not assignable to parameter of type '(error: any) => Promise<number>'.
!!! error TS2769: Property 'catch' is missing in type 'IPromise<string>' but required in type 'Promise<number>'.
!!! related TS2728 /.ts/lib.es5.d.ts:1492:5: 'catch' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1509:5: 'catch' is declared here.
!!! related TS2771 tests/cases/compiler/promisePermutations.ts:5:5: The last overload is declared here.
var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok

View file

@ -351,7 +351,7 @@ tests/cases/compiler/promisePermutations2.ts(159,21): error TS2345: Argument of
~~~~~~~~~
!!! error TS2345: Argument of type '(x: any) => IPromise<string>' is not assignable to parameter of type '(error: any) => Promise<number>'.
!!! error TS2345: Property 'catch' is missing in type 'IPromise<string>' but required in type 'Promise<number>'.
!!! related TS2728 /.ts/lib.es5.d.ts:1492:5: 'catch' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1509:5: 'catch' is declared here.
var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok
var r11: IPromise<number>;

View file

@ -398,7 +398,7 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of
!!! error TS2769: The last overload gave the following error.
!!! error TS2769: Argument of type '(x: any) => IPromise<string>' is not assignable to parameter of type '(error: any) => Promise<number>'.
!!! error TS2769: Property 'catch' is missing in type 'IPromise<string>' but required in type 'Promise<number>'.
!!! related TS2728 /.ts/lib.es5.d.ts:1492:5: 'catch' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1509:5: 'catch' is declared here.
!!! related TS2771 tests/cases/compiler/promisePermutations3.ts:7:5: The last overload is declared here.
var s10g = s10.then(testFunctionP, nIPromise, sIPromise).then(sPromise, sIPromise, sIPromise); // ok
@ -445,5 +445,5 @@ tests/cases/compiler/promisePermutations3.ts(165,21): error TS2345: Argument of
~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ <T>(x: T): IPromise<T>; <T>(x: T, y: T): Promise<T>; }' is not assignable to parameter of type '(value: (x: any) => any) => Promise<unknown>'.
!!! error TS2345: Property 'catch' is missing in type 'IPromise<any>' but required in type 'Promise<unknown>'.
!!! related TS2728 /.ts/lib.es5.d.ts:1492:5: 'catch' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1509:5: 'catch' is declared here.
var s12c = s12.then(testFunction12P, testFunction12, testFunction12); // ok

View file

@ -5,4 +5,4 @@ tests/cases/compiler/redefineArray.ts(1,1): error TS2741: Property 'isArray' is
Array = function (n:number, s:string) {return n;};
~~~~~
!!! error TS2741: Property 'isArray' is missing in type '<T>(n: number, s: string) => number' but required in type 'ArrayConstructor'.
!!! related TS2728 /.ts/lib.es5.d.ts:1443:5: 'isArray' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1460:5: 'isArray' is declared here.

View file

@ -19,7 +19,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.2_A1.5_T2.ts(20,3): error
$ERROR('#1: eval("\\u00A0var x\\u00A0= 1\\u00A0"); x === 1. Actual: ' + (x));
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
//CHECK#2
@ -28,7 +28,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.2_A1.5_T2.ts(20,3): error
$ERROR('#2:  var x = 1 ; x === 1. Actual: ' + (x));
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}

View file

@ -21,7 +21,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.3_A1.1_T2.ts(17,3): error
$ERROR('#1: var\\nx\\n=\\n1\\n; x === 1. Actual: ' + (x));
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}

View file

@ -50,70 +50,70 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.6_A4.2_T1.ts(142,3): error
$ERROR('#А');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0411 = 1;
if (Б !== 1) {
$ERROR('#Б');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0412 = 1;
if (В !== 1) {
$ERROR('#В');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0413 = 1;
if (Г !== 1) {
$ERROR('#Г');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0414 = 1;
if (Д !== 1) {
$ERROR('#Д');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0415 = 1;
if (Е !== 1) {
$ERROR('#Е');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0416 = 1;
if (Ж !== 1) {
$ERROR('#Ж');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0417 = 1;
if (З !== 1) {
$ERROR('#З');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0418 = 1;
if (И !== 1) {
$ERROR('#И');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u0419 = 1;
if (Й !== 1) {
$ERROR('#Й');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:1016:13: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1033:13: 'Error' is declared here.
}
var \u041A = 1;
if (К !== 1) {

View file

@ -0,0 +1,37 @@
// @declaration: true
// @target: es2015
// @module: es2015, commonjs, esnext
// @filename: 0.ts
export const a = 1;
export const b = 2;
// @filename: 1.ts
import './0' assert { type: "json" }
import { a, b } from './0' assert { "type": "json" }
import * as foo from './0' assert { type: "json" }
a;
b;
foo.a;
foo.b;
// @filename: 2.ts
import { a, b } from './0' assert {}
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
a;
b;
c;
d;
// @filename: 3.ts
const a = import('./0')
const b = import('./0', { assert: { type: "json" } })
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
const d = import('./0', { assert: {} })
const dd = import('./0', {})
declare function foo(): any;
const e = import('./0', foo())
const f = import()
const g = import('./0', {}, {})
const h = import('./0', { assert: { type: "json" }},)

View file

@ -0,0 +1,17 @@
// @declaration: true
// @target: es2015
// @module: es2015, commonjs, esnext
// @filename: 0.ts
export const a = 1;
export const b = 2;
// @filename: 1.ts
export {} from './0' assert { type: "json" }
export { a, b } from './0' assert { type: "json" }
export * from './0' assert { type: "json" }
export * as ns from './0' assert { type: "json" }
// @filename: 2.ts
export { a, b } from './0' assert {}
export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }

View file

@ -0,0 +1,15 @@
// @declaration: true
// @target: es2015
// @module: es2015, esnext
// @filename: 0.ts
export interface I { }
// @filename: 1.ts
export type {} from './0' assert { type: "json" }
export type { I } from './0' assert { type: "json" }
// @filename: 2.ts
import type { I } from './0' assert { type: "json" }
import type * as foo from './0' assert { type: "json" }

View file

@ -0,0 +1,13 @@
/// <reference path='fourslash.ts' />
// @target: esnext
// @module: esnext
// @filename: main.ts
////import("./other.json", {/*0*/});
////import("./other.json", { asse/*1*/});
// @filename: other.json
////{}
verify.baselineCompletions();