From 7a05f24cdf955fef353178a93e4033cfebd63202 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Fri, 25 Aug 2023 23:52:13 +0300 Subject: [PATCH 01/21] feat(53656): Add support for the revised import attributes proposal --- src/compiler/checker.ts | 136 +- src/compiler/diagnosticMessages.json | 38 +- src/compiler/emitter.ts | 35 +- src/compiler/factory/nodeFactory.ts | 82 +- src/compiler/factory/nodeTests.ts | 17 + src/compiler/factory/utilities.ts | 1 + src/compiler/parser.ts | 134 +- src/compiler/program.ts | 32 +- src/compiler/transformers/declarations.ts | 38 +- src/compiler/transformers/jsx.ts | 2 +- .../transformers/module/esnextAnd2015.ts | 3 + src/compiler/transformers/ts.ts | 3 + src/compiler/types.ts | 81 +- src/compiler/utilities.ts | 11 + src/compiler/utilitiesPublic.ts | 6 + src/compiler/visitorPublic.ts | 31 + src/harness/fourslashInterfaceImpl.ts | 1 + src/lib/es5.d.ts | 10 +- .../codefixes/convertToTypeOnlyExport.ts | 2 + .../codefixes/convertToTypeOnlyImport.ts | 4 +- .../fixAddModuleReferTypeMissingTypeof.ts | 2 +- .../codefixes/fixImportNonExportedMember.ts | 3 +- src/services/codefixes/importFixes.ts | 1 + src/services/codefixes/requireInTs.ts | 2 +- src/services/codefixes/splitTypeOnlyImport.ts | 2 + src/services/organizeImports.ts | 3 + src/services/outliningElementsCollector.ts | 6 +- src/services/refactors/convertExport.ts | 2 +- src/services/refactors/convertImport.ts | 2 +- src/services/refactors/moveToFile.ts | 5 +- src/services/utilities.ts | 1 + src/testRunner/unittests/transform.ts | 3 +- .../unittests/tscWatch/moduleResolution.ts | 71 + tests/baselines/reference/api/typescript.d.ts | 214 +- .../completionImportAttributes.baseline | 272 + .../completionImportCallAssertion.baseline | 126 +- .../completionsImportWithKeyword.baseline | 25192 ++++++++++++++++ ...esNonStringImportAttributes.baseline.jsonc | 4 + ...portAssertion1(module=commonjs).errors.txt | 4 +- ...importAssertion1(module=esnext).errors.txt | 8 +- ...ortAttributes1(module=commonjs).errors.txt | 75 + .../importAttributes1(module=commonjs).js | 89 + ...importAttributes1(module=commonjs).symbols | 105 + .../importAttributes1(module=commonjs).types | 138 + ...mportAttributes1(module=es2015).errors.txt | 75 + .../importAttributes1(module=es2015).js | 82 + .../importAttributes1(module=es2015).symbols | 105 + .../importAttributes1(module=es2015).types | 138 + ...mportAttributes1(module=esnext).errors.txt | 39 + .../importAttributes1(module=esnext).js | 82 + .../importAttributes1(module=esnext).symbols | 105 + .../importAttributes1(module=esnext).types | 138 + ...ortAttributes2(module=commonjs).errors.txt | 34 + .../importAttributes2(module=commonjs).js | 69 + ...importAttributes2(module=commonjs).symbols | 30 + .../importAttributes2(module=commonjs).types | 41 + ...mportAttributes2(module=es2015).errors.txt | 34 + .../importAttributes2(module=es2015).js | 41 + .../importAttributes2(module=es2015).symbols | 30 + .../importAttributes2(module=es2015).types | 41 + .../importAttributes2(module=esnext).js | 40 + .../importAttributes2(module=esnext).symbols | 30 + .../importAttributes2(module=esnext).types | 41 + ...mportAttributes3(module=es2015).errors.txt | 25 + .../importAttributes3(module=es2015).js | 30 + .../importAttributes3(module=es2015).symbols | 18 + .../importAttributes3(module=es2015).types | 23 + ...mportAttributes3(module=esnext).errors.txt | 25 + .../importAttributes3(module=esnext).js | 30 + .../importAttributes3(module=esnext).symbols | 18 + .../importAttributes3(module=esnext).types | 23 + .../reference/importAttributes4.errors.txt | 10 + .../baselines/reference/importAttributes4.js | 8 + .../reference/importAttributes4.symbols | 6 + .../reference/importAttributes4.types | 6 + .../reference/importAttributes5.errors.txt | 11 + .../baselines/reference/importAttributes5.js | 8 + .../reference/importAttributes5.symbols | 6 + .../reference/importAttributes5.types | 6 + .../reference/importAttributes6.errors.txt | 28 + .../baselines/reference/importAttributes6.js | 13 + .../reference/importAttributes6.symbols | 24 + .../reference/importAttributes6.types | 38 + .../baselines/reference/importAttributes7.js | 75 + .../reference/importAttributes7.symbols | 36 + .../reference/importAttributes7.types | 48 + .../baselines/reference/importAttributes8.js | 22 + .../reference/importAttributes8.symbols | 20 + .../reference/importAttributes8.types | 26 + .../importAttributesNonstring.errors.txt | 32 + .../reference/importAttributesNonstring.js | 17 + .../importAttributesNonstring.symbols | 24 + .../reference/importAttributesNonstring.types | 38 + ...mportCallExpressionGrammarError.errors.txt | 4 +- ...tionEmitDynamicImportWithPackageExports.js | 6 +- ...nEmitDynamicImportWithPackageExports.types | 12 +- ...ImportAttributes(module=node16).errors.txt | 25 + ...eModulesImportAttributes(module=node16).js | 21 + ...lesImportAttributes(module=node16).symbols | 28 + ...dulesImportAttributes(module=node16).types | 39 + ...portAttributes(module=nodenext).errors.txt | 22 + ...odulesImportAttributes(module=nodenext).js | 21 + ...sImportAttributes(module=nodenext).symbols | 28 + ...lesImportAttributes(module=nodenext).types | 39 + ...DeclarationEmit1(module=node16).errors.txt | 43 + ...utesModeDeclarationEmit1(module=node16).js | 45 + ...odeDeclarationEmit1(module=node16).symbols | 36 + ...sModeDeclarationEmit1(module=node16).types | 30 + ...clarationEmit1(module=nodenext).errors.txt | 43 + ...esModeDeclarationEmit1(module=nodenext).js | 45 + ...eDeclarationEmit1(module=nodenext).symbols | 36 + ...odeDeclarationEmit1(module=nodenext).types | 30 + ...DeclarationEmit2(module=node16).errors.txt | 48 + ...utesModeDeclarationEmit2(module=node16).js | 49 + ...odeDeclarationEmit2(module=node16).symbols | 36 + ...sModeDeclarationEmit2(module=node16).types | 30 + ...clarationEmit2(module=nodenext).errors.txt | 48 + ...esModeDeclarationEmit2(module=nodenext).js | 49 + ...eDeclarationEmit2(module=nodenext).symbols | 36 + ...odeDeclarationEmit2(module=nodenext).types | 30 + ...rationEmitErrors(module=node16).errors.txt | 43 + ...odeDeclarationEmitErrors(module=node16).js | 39 + ...clarationEmitErrors(module=node16).symbols | 30 + ...DeclarationEmitErrors(module=node16).types | 26 + ...tionEmitErrors(module=nodenext).errors.txt | 43 + ...eDeclarationEmitErrors(module=nodenext).js | 39 + ...arationEmitErrors(module=nodenext).symbols | 30 + ...clarationEmitErrors(module=nodenext).types | 26 + ...eDeclarationEmit(module=node16).errors.txt | 29 + ...sTypeModeDeclarationEmit(module=node16).js | 36 + ...ModeDeclarationEmit(module=node16).symbols | 22 + ...peModeDeclarationEmit(module=node16).types | 24 + ...eclarationEmit(module=nodenext).errors.txt | 29 + ...ypeModeDeclarationEmit(module=nodenext).js | 36 + ...deDeclarationEmit(module=nodenext).symbols | 22 + ...ModeDeclarationEmit(module=nodenext).types | 24 + ...rationEmitErrors(module=node16).errors.txt | 325 + ...odeDeclarationEmitErrors(module=node16).js | 153 + ...clarationEmitErrors(module=node16).symbols | 128 + ...DeclarationEmitErrors(module=node16).types | 187 + ...tionEmitErrors(module=nodenext).errors.txt | 325 + ...eDeclarationEmitErrors(module=nodenext).js | 153 + ...arationEmitErrors(module=nodenext).symbols | 128 + ...clarationEmitErrors(module=nodenext).types | 187 + ...TypeModeDeclarationEmit1(module=node16).js | 30 +- ...peModeDeclarationEmit1(module=nodenext).js | 30 +- ...ationEmitErrors1(module=node16).errors.txt | 12 +- ...deDeclarationEmitErrors1(module=node16).js | 8 +- ...ionEmitErrors1(module=nodenext).errors.txt | 12 +- ...DeclarationEmitErrors1(module=nodenext).js | 8 +- .../parseImportAttributesError.errors.txt | 44 + .../reference/parseImportAttributesError.js | 39 + .../parseImportAttributesError.symbols | 22 + .../parseImportAttributesError.types | 30 + .../reference/plainJSGrammarErrors.errors.txt | 8 +- ...s-with-partially-used-import-attributes.js | 304 + .../compiler/importAttributesNonstring.ts | 13 + .../compiler/parseImportAttributesError.ts | 27 + .../importAttributes/importAttributes1.ts | 34 + .../importAttributes/importAttributes2.ts | 17 + .../importAttributes/importAttributes3.ts | 14 + .../importAttributes/importAttributes4.ts | 1 + .../importAttributes/importAttributes5.ts | 1 + .../importAttributes/importAttributes6.ts | 8 + .../importAttributes/importAttributes7.ts | 19 + .../importAttributes/importAttributes8.ts | 13 + .../node/nodeModulesImportAttributes.ts | 13 + ...lesImportAttributesModeDeclarationEmit1.ts | 29 + ...lesImportAttributesModeDeclarationEmit2.ts | 34 + ...portAttributesModeDeclarationEmitErrors.ts | 29 + ...ImportAttributesTypeModeDeclarationEmit.ts | 24 + ...AttributesTypeModeDeclarationEmitErrors.ts | 72 + .../fourslash/completionImportAttributes.ts | 13 + .../fourslash/completionsImportWithKeyword.ts | 19 + ...getOccurrencesNonStringImportAttributes.ts | 7 + ...liningSpansForImportAndExportAttributes.ts | 48 + 176 files changed, 32564 insertions(+), 267 deletions(-) create mode 100644 tests/baselines/reference/completionImportAttributes.baseline create mode 100644 tests/baselines/reference/completionsImportWithKeyword.baseline create mode 100644 tests/baselines/reference/getOccurrencesNonStringImportAttributes.baseline.jsonc create mode 100644 tests/baselines/reference/importAttributes1(module=commonjs).errors.txt create mode 100644 tests/baselines/reference/importAttributes1(module=commonjs).js create mode 100644 tests/baselines/reference/importAttributes1(module=commonjs).symbols create mode 100644 tests/baselines/reference/importAttributes1(module=commonjs).types create mode 100644 tests/baselines/reference/importAttributes1(module=es2015).errors.txt create mode 100644 tests/baselines/reference/importAttributes1(module=es2015).js create mode 100644 tests/baselines/reference/importAttributes1(module=es2015).symbols create mode 100644 tests/baselines/reference/importAttributes1(module=es2015).types create mode 100644 tests/baselines/reference/importAttributes1(module=esnext).errors.txt create mode 100644 tests/baselines/reference/importAttributes1(module=esnext).js create mode 100644 tests/baselines/reference/importAttributes1(module=esnext).symbols create mode 100644 tests/baselines/reference/importAttributes1(module=esnext).types create mode 100644 tests/baselines/reference/importAttributes2(module=commonjs).errors.txt create mode 100644 tests/baselines/reference/importAttributes2(module=commonjs).js create mode 100644 tests/baselines/reference/importAttributes2(module=commonjs).symbols create mode 100644 tests/baselines/reference/importAttributes2(module=commonjs).types create mode 100644 tests/baselines/reference/importAttributes2(module=es2015).errors.txt create mode 100644 tests/baselines/reference/importAttributes2(module=es2015).js create mode 100644 tests/baselines/reference/importAttributes2(module=es2015).symbols create mode 100644 tests/baselines/reference/importAttributes2(module=es2015).types create mode 100644 tests/baselines/reference/importAttributes2(module=esnext).js create mode 100644 tests/baselines/reference/importAttributes2(module=esnext).symbols create mode 100644 tests/baselines/reference/importAttributes2(module=esnext).types create mode 100644 tests/baselines/reference/importAttributes3(module=es2015).errors.txt create mode 100644 tests/baselines/reference/importAttributes3(module=es2015).js create mode 100644 tests/baselines/reference/importAttributes3(module=es2015).symbols create mode 100644 tests/baselines/reference/importAttributes3(module=es2015).types create mode 100644 tests/baselines/reference/importAttributes3(module=esnext).errors.txt create mode 100644 tests/baselines/reference/importAttributes3(module=esnext).js create mode 100644 tests/baselines/reference/importAttributes3(module=esnext).symbols create mode 100644 tests/baselines/reference/importAttributes3(module=esnext).types create mode 100644 tests/baselines/reference/importAttributes4.errors.txt create mode 100644 tests/baselines/reference/importAttributes4.js create mode 100644 tests/baselines/reference/importAttributes4.symbols create mode 100644 tests/baselines/reference/importAttributes4.types create mode 100644 tests/baselines/reference/importAttributes5.errors.txt create mode 100644 tests/baselines/reference/importAttributes5.js create mode 100644 tests/baselines/reference/importAttributes5.symbols create mode 100644 tests/baselines/reference/importAttributes5.types create mode 100644 tests/baselines/reference/importAttributes6.errors.txt create mode 100644 tests/baselines/reference/importAttributes6.js create mode 100644 tests/baselines/reference/importAttributes6.symbols create mode 100644 tests/baselines/reference/importAttributes6.types create mode 100644 tests/baselines/reference/importAttributes7.js create mode 100644 tests/baselines/reference/importAttributes7.symbols create mode 100644 tests/baselines/reference/importAttributes7.types create mode 100644 tests/baselines/reference/importAttributes8.js create mode 100644 tests/baselines/reference/importAttributes8.symbols create mode 100644 tests/baselines/reference/importAttributes8.types create mode 100644 tests/baselines/reference/importAttributesNonstring.errors.txt create mode 100644 tests/baselines/reference/importAttributesNonstring.js create mode 100644 tests/baselines/reference/importAttributesNonstring.symbols create mode 100644 tests/baselines/reference/importAttributesNonstring.types create mode 100644 tests/baselines/reference/nodeModulesImportAttributes(module=node16).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributes(module=node16).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributes(module=node16).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributes(module=node16).types create mode 100644 tests/baselines/reference/nodeModulesImportAttributes(module=nodenext).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributes(module=nodenext).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributes(module=nodenext).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributes(module=nodenext).types create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).types create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).types create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).types create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).types create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).types create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).types create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).types create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).types create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).types create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).js create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).symbols create mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).types create mode 100644 tests/baselines/reference/parseImportAttributesError.errors.txt create mode 100644 tests/baselines/reference/parseImportAttributesError.js create mode 100644 tests/baselines/reference/parseImportAttributesError.symbols create mode 100644 tests/baselines/reference/parseImportAttributesError.types create mode 100644 tests/baselines/reference/tscWatch/moduleResolution/module-resolutions-from-files-with-partially-used-import-attributes.js create mode 100644 tests/cases/compiler/importAttributesNonstring.ts create mode 100644 tests/cases/compiler/parseImportAttributesError.ts create mode 100644 tests/cases/conformance/importAttributes/importAttributes1.ts create mode 100644 tests/cases/conformance/importAttributes/importAttributes2.ts create mode 100644 tests/cases/conformance/importAttributes/importAttributes3.ts create mode 100644 tests/cases/conformance/importAttributes/importAttributes4.ts create mode 100644 tests/cases/conformance/importAttributes/importAttributes5.ts create mode 100644 tests/cases/conformance/importAttributes/importAttributes6.ts create mode 100644 tests/cases/conformance/importAttributes/importAttributes7.ts create mode 100644 tests/cases/conformance/importAttributes/importAttributes8.ts create mode 100644 tests/cases/conformance/node/nodeModulesImportAttributes.ts create mode 100644 tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts create mode 100644 tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts create mode 100644 tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts create mode 100644 tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts create mode 100644 tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmitErrors.ts create mode 100644 tests/cases/fourslash/completionImportAttributes.ts create mode 100644 tests/cases/fourslash/completionsImportWithKeyword.ts create mode 100644 tests/cases/fourslash/getOccurrencesNonStringImportAttributes.ts create mode 100644 tests/cases/fourslash/outliningSpansForImportAndExportAttributes.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index fd479090c5372..6a57a3136ec0b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -25,6 +25,7 @@ import { ArrayTypeNode, ArrowFunction, AsExpression, + AssertClause, AssertionExpression, AssignmentDeclarationKind, AssignmentKind, @@ -338,7 +339,7 @@ import { getPropertyNameForPropertyNameNode, getPropertyNameFromType, getResolutionDiagnostic, - getResolutionModeOverrideForClause, + getResolutionModeOverride, getResolvedExternalModuleName, getResolvedModule, getResolveJsonModule, @@ -392,6 +393,7 @@ import { hasOverrideModifier, hasPossibleExternalModuleReference, hasQuestionToken, + hasResolutionModeOverride, hasRestParameter, hasScopeMarker, hasStaticModifier, @@ -404,6 +406,7 @@ import { IdentifierTypePredicate, idText, IfStatement, + ImportAttributes, ImportCall, ImportClause, ImportDeclaration, @@ -411,7 +414,7 @@ import { ImportOrExportSpecifier, ImportsNotUsedAsValues, ImportSpecifier, - ImportTypeAssertionContainer, + ImportTypeAttributes, ImportTypeNode, IndexedAccessType, IndexedAccessTypeNode, @@ -4982,11 +4985,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } if (moduleResolutionKind === ModuleResolutionKind.Node16 || moduleResolutionKind === ModuleResolutionKind.NodeNext) { const isSyncImport = (currentSourceFile.impliedNodeFormat === ModuleKind.CommonJS && !findAncestor(location, isImportCall)) || !!findAncestor(location, isImportEqualsDeclaration); - const overrideClauseHost = findAncestor(location, l => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l)) as ImportTypeNode | ImportDeclaration | ExportDeclaration | undefined; - const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? overrideClauseHost.assertions?.assertClause : overrideClauseHost?.assertClause; + const overrideHost = findAncestor(location, l => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l)) as ImportTypeNode | ImportDeclaration | ExportDeclaration | undefined; // An override clause will take effect for type-only imports and import types, and allows importing the types across formats, regardless of // normal mode restrictions - if (isSyncImport && sourceFile.impliedNodeFormat === ModuleKind.ESNext && !getResolutionModeOverrideForClause(overrideClause)) { + if (isSyncImport && sourceFile.impliedNodeFormat === ModuleKind.ESNext && !hasResolutionModeOverride(overrideHost)) { if (findAncestor(location, isImportEqualsDeclaration)) { // ImportEquals in a ESM file resolving to another ESM file error(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference); @@ -7104,6 +7106,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { root, root.argument, root.assertions, + root.attributes, qualifier, typeArguments, root.isTypeOf, @@ -7891,13 +7894,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const contextFile = getSourceFileOfNode(getOriginalNode(context.enclosingDeclaration)); const targetFile = getSourceFileOfModule(chain[0]); let specifier: string | undefined; - let assertion: ImportTypeAssertionContainer | undefined; + let attributes: ImportTypeAttributes | undefined; if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Node16 || getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeNext) { // An `import` type directed at an esm format file is only going to resolve in esm mode - set the esm mode assertion if (targetFile?.impliedNodeFormat === ModuleKind.ESNext && targetFile.impliedNodeFormat !== contextFile?.impliedNodeFormat) { specifier = getSpecifierForModuleSymbol(chain[0], context, ModuleKind.ESNext); - assertion = factory.createImportTypeAssertionContainer(factory.createAssertClause(factory.createNodeArray([ - factory.createAssertEntry( + attributes = factory.createImportTypeAttributes(factory.createImportAttributes(factory.createNodeArray([ + factory.createImportAttribute( factory.createStringLiteral("resolution-mode"), factory.createStringLiteral("import"), ), @@ -7920,8 +7923,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { specifier = oldSpecifier; } else { - assertion = factory.createImportTypeAssertionContainer(factory.createAssertClause(factory.createNodeArray([ - factory.createAssertEntry( + attributes = factory.createImportTypeAttributes(factory.createImportAttributes(factory.createNodeArray([ + factory.createImportAttribute( factory.createStringLiteral("resolution-mode"), factory.createStringLiteral(swappedMode === ModuleKind.ESNext ? "import" : "require"), ), @@ -7930,7 +7933,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } - if (!assertion) { + if (!attributes) { // If ultimately we can only name the symbol with a reference that dives into a `node_modules` folder, we should error // since declaration files with these kinds of references are liable to fail when published :( context.encounteredError = true; @@ -7947,12 +7950,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const lastId = isIdentifier(nonRootParts) ? nonRootParts : nonRootParts.right; setIdentifierTypeArguments(lastId, /*typeArguments*/ undefined); } - return factory.createImportTypeNode(lit, assertion, nonRootParts as EntityName, typeParameterNodes as readonly TypeNode[], isTypeOf); + return factory.createImportTypeNode(lit, /*assertions*/ undefined, attributes, nonRootParts as EntityName, typeParameterNodes as readonly TypeNode[], isTypeOf); } else { const splitNode = getTopmostIndexedAccessType(nonRootParts); const qualifier = (splitNode.objectType as TypeReferenceNode).typeName; - return factory.createIndexedAccessTypeNode(factory.createImportTypeNode(lit, assertion, qualifier, typeParameterNodes as readonly TypeNode[], isTypeOf), splitNode.indexType); + return factory.createIndexedAccessTypeNode(factory.createImportTypeNode(lit, /*assertions*/ undefined, attributes, qualifier, typeParameterNodes as readonly TypeNode[], isTypeOf), splitNode.indexType); } } @@ -8456,6 +8459,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { node, factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier(node, node.argument.literal)), node.assertions, + node.attributes, node.qualifier, visitNodes(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode), node.isTypeOf, @@ -8678,7 +8682,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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.assertClause && !!d.exportClause && isNamedExports(d.exportClause)); + const index = findIndex(statements, d => isExportDeclaration(d) && !d.moduleSpecifier && !(d.assertClause || d.attributes) && !!d.exportClause && isNamedExports(d.exportClause)); if (index >= 0) { const exportDecl = statements[index] as ExportDeclaration & { readonly exportClause: NamedExports; }; const replacements = mapDefined(exportDecl.exportClause.elements, e => { @@ -8711,6 +8715,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { ), exportDecl.moduleSpecifier, exportDecl.assertClause, + exportDecl.attributes, ); } } @@ -9422,6 +9427,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { ), factory.createStringLiteral(specifier), /*assertClause*/ undefined, + /*attributes*/ undefined, ), ModifierFlags.None, ); @@ -9506,6 +9512,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { factory.createImportClause(/*isTypeOnly*/ false, factory.createIdentifier(localName), /*namedBindings*/ undefined), specifier, (node as ImportClause).parent.assertClause, + (node as ImportClause).parent.attributes, ), ModifierFlags.None, ); @@ -9520,6 +9527,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, factory.createNamespaceImport(factory.createIdentifier(localName))), specifier, (node as NamespaceImport).parent.parent.assertClause, + (node as ImportClause).parent.attributes, ), ModifierFlags.None, ); @@ -9555,6 +9563,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { ), specifier, (node as ImportSpecifier).parent.parent.parent.assertClause, + (node as ImportSpecifier).parent.parent.parent.attributes, ), ModifierFlags.None, ); @@ -39588,14 +39597,25 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function checkImportType(node: ImportTypeNode) { checkSourceElement(node.argument); - if (node.assertions) { - const override = getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode); - if (override) { + if (node.assertions || node.attributes) { + const override = getResolutionModeOverride(node.assertions?.assertClause || node.attributes?.attributes, grammarErrorOnNode); + const errorNode = node.assertions?.assertClause || node.attributes?.attributes; + if (override && errorNode) { if (!isNightly()) { - grammarErrorOnNode(node.assertions.assertClause, Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next); + grammarErrorOnNode( + errorNode, + node.assertions?.assertClause + ? Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next + : Diagnostics.resolution_mode_attributes_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, + ); } if (getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Node16 && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.NodeNext) { - grammarErrorOnNode(node.assertions.assertClause, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext); + grammarErrorOnNode( + errorNode, + node.assertions?.assertClause + ? Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext + : Diagnostics.resolution_mode_attribute_are_only_supported_when_moduleResolution_is_node16_or_nodenext, + ); } } } @@ -44838,19 +44858,28 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return false; } } - if (!isImportEqualsDeclaration(node) && node.assertClause) { - let hasError = false; - for (const clause of node.assertClause.elements) { - if (!isStringLiteral(clause.value)) { - hasError = true; - error(clause.value, Diagnostics.Import_assertion_values_must_be_string_literal_expressions); - } + if (!isImportEqualsDeclaration(node)) { + if (node.attributes) { + return checkImportAttributeValue(node.attributes, Diagnostics.Import_attribute_values_must_be_string_literal_expressions); + } + if (node.assertClause) { + return checkImportAttributeValue(node.assertClause, Diagnostics.Import_assertion_values_must_be_string_literal_expressions); } - return !hasError; } return true; } + function checkImportAttributeValue(node: AssertClause | ImportAttributes, message: DiagnosticMessage) { + let hasError = false; + for (const clause of node.elements) { + if (!isStringLiteral(clause.value)) { + hasError = true; + error(clause.value, message); + } + } + return !hasError; + } + function checkAliasSymbol(node: AliasDeclarationNode) { let symbol = getSymbolOfDeclaration(node); const target = resolveAlias(symbol); @@ -45027,37 +45056,50 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } - function checkAssertClause(declaration: ImportDeclaration | ExportDeclaration) { - if (declaration.assertClause) { - const validForTypeAssertions = isExclusivelyTypeOnlyImportOrExport(declaration); - const override = getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined); - if (validForTypeAssertions && override) { + function checkImportAttributes(declaration: ImportDeclaration | ExportDeclaration) { + const node = declaration.attributes || declaration.assertClause; + if (node) { + const validForTypeAttributes = isExclusivelyTypeOnlyImportOrExport(declaration); + const override = getResolutionModeOverride(node, validForTypeAttributes ? grammarErrorOnNode : undefined); + if (validForTypeAttributes && override) { if (!isNightly()) { - grammarErrorOnNode(declaration.assertClause, Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next); + grammarErrorOnNode( + node, + declaration.attributes + ? Diagnostics.resolution_mode_attributes_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next + : Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, + ); } if (getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Node16 && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.NodeNext) { - return grammarErrorOnNode(declaration.assertClause, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext); + return grammarErrorOnNode( + node, + declaration.attributes + ? Diagnostics.resolution_mode_attribute_are_only_supported_when_moduleResolution_is_node16_or_nodenext + : Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext, + ); } return; // Other grammar checks do not apply to type-only imports with resolution mode assertions } const mode = (moduleKind === ModuleKind.NodeNext) && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier); if (mode !== ModuleKind.ESNext && moduleKind !== ModuleKind.ESNext) { - return grammarErrorOnNode( - declaration.assertClause, - moduleKind === ModuleKind.NodeNext - ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_transpile_to_CommonJS_require_calls - : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext, - ); + const message = declaration.attributes + ? moduleKind === ModuleKind.NodeNext + ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_transpile_to_CommonJS_require_calls + : Diagnostics.Import_attributes_cannot_be_used_with_type_only_imports_or_exports + : moduleKind === ModuleKind.NodeNext + ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_transpile_to_CommonJS_require_calls + : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext; + return grammarErrorOnNode(node, message); } if (isImportDeclaration(declaration) ? declaration.importClause?.isTypeOnly : declaration.isTypeOnly) { - return grammarErrorOnNode(declaration.assertClause, Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports); + return grammarErrorOnNode(node, declaration.attributes ? Diagnostics.Import_attributes_cannot_be_used_with_type_only_imports_or_exports : Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports); } if (override) { - return grammarErrorOnNode(declaration.assertClause, Diagnostics.resolution_mode_can_only_be_set_for_type_only_imports); + return grammarErrorOnNode(node, Diagnostics.resolution_mode_can_only_be_set_for_type_only_imports); } } } @@ -45093,7 +45135,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } } - checkAssertClause(node); + checkImportAttributes(node); } function checkImportEqualsDeclaration(node: ImportEqualsDeclaration) { @@ -45189,7 +45231,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } } } - checkAssertClause(node); + checkImportAttributes(node); } function checkGrammarExportDeclaration(node: ExportDeclaration): boolean { @@ -49728,13 +49770,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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_node16_or_nodenext); + const importAttributesArgument = nodeArguments[1]; + return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext); } } 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); + return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_set_of_attributes_as_arguments); } // see: parseArgumentOrArrayLiteralElement...we use this function which parse arguments of callExpression to parse specifier for dynamic import. diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 117f52a8e2c84..789666a8dc311 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -19,6 +19,10 @@ "category": "Error", "code": 1007 }, + "The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword.": { + "category": "Error", + "code": 1008 + }, "Trailing comma not allowed.": { "category": "Error", "code": 1009 @@ -1472,7 +1476,7 @@ "category": "Message", "code": 1449 }, - "Dynamic imports can only accept a module specifier and an optional assertion as arguments": { + "Dynamic imports can only accept a module specifier and an optional set of attributes as arguments": { "category": "Message", "code": 1450 }, @@ -1520,6 +1524,18 @@ "category": "Message", "code": 1461 }, + "'resolution-mode' attribute are only supported when `moduleResolution` is `node16` or `nodenext`.": { + "category": "Error", + "code": 1462 + }, + "`resolution-mode` is the only valid key for type import attributes.": { + "category": "Error", + "code": 1463 + }, + "Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`.": { + "category": "Error", + "code": 1464 + }, "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output.": { "category": "Error", @@ -1625,6 +1641,10 @@ "category": "Error", "code": 1495 }, + "Identifier, string literal or number literal expected.": { + "category": "Error", + "code": 1496 + }, "The types of '{0}' are incompatible between these types.": { "category": "Error", @@ -3663,6 +3683,18 @@ "category": "Error", "code": 2854 }, + "Import attributes are not allowed on statements that transpile to CommonJS 'require' calls.": { + "category": "Error", + "code": 2855 + }, + "Import attributes cannot be used with type-only imports or exports.": { + "category": "Error", + "code": 2856 + }, + "Import attribute values must be string literal expressions.": { + "category": "Error", + "code": 2857 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", @@ -4100,6 +4132,10 @@ "category": "Error", "code": 4125 }, + "'resolution-mode' attributes are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.": { + "category": "Error", + "code": 4126 + }, "The current host does not support the '{0}' option.": { "category": "Error", diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index d407dadc246ae..9515afa8fbafc 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -191,6 +191,8 @@ import { Identifier, idText, IfStatement, + ImportAttribute, + ImportAttributes, ImportClause, ImportDeclaration, ImportEqualsDeclaration, @@ -2058,6 +2060,10 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri return emitAssertClause(node as AssertClause); case SyntaxKind.AssertEntry: return emitAssertEntry(node as AssertEntry); + case SyntaxKind.ImportAttributes: + return emitImportAttributes(node as ImportAttributes); + case SyntaxKind.ImportAttribute: + return emitImportAttribute(node as ImportAttribute); case SyntaxKind.MissingDeclaration: return; @@ -3991,8 +3997,8 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri writeSpace(); } emitExpression(node.moduleSpecifier); - if (node.assertClause) { - emitWithLeadingSpace(node.assertClause); + if (node.attributes || node.assertClause) { + emitWithLeadingSpace(node.attributes || node.assertClause); } writeTrailingSemicolon(); } @@ -4066,8 +4072,8 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri writeSpace(); emitExpression(node.moduleSpecifier); } - if (node.assertClause) { - emitWithLeadingSpace(node.assertClause); + if (node.attributes || node.assertClause) { + emitWithLeadingSpace(node.attributes || node.assertClause); } writeTrailingSemicolon(); } @@ -4093,6 +4099,27 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri emit(value); } + function emitImportAttributes(node: ImportAttributes) { + emitTokenWithComment(SyntaxKind.WithKeyword, node.pos, writeKeyword, node); + writeSpace(); + const elements = node.elements; + emitList(node, elements, ListFormat.ImportAttributes); + } + + function emitImportAttribute(node: ImportAttribute) { + 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(); diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index ededdbd057ab9..df6c99566c3c3 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -137,11 +137,15 @@ import { IfStatement, ImmediatelyInvokedArrowFunction, ImmediatelyInvokedFunctionExpression, + ImportAttribute, + ImportAttributeName, + ImportAttributes, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportSpecifier, ImportTypeAssertionContainer, + ImportTypeAttributes, ImportTypeNode, IndexedAccessTypeNode, IndexSignatureDeclaration, @@ -791,6 +795,12 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode updateAssertEntry, createImportTypeAssertionContainer, updateImportTypeAssertionContainer, + createImportTypeAttributes, + updateImportTypeAttributes, + createImportAttributes, + updateImportAttributes, + createImportAttribute, + updateImportAttribute, createNamespaceImport, updateNamespaceImport, createNamespaceExport, @@ -2644,6 +2654,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function createImportTypeNode( argument: TypeNode, assertions?: ImportTypeAssertionContainer, + attributes?: ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf = false, @@ -2651,6 +2662,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode const node = createBaseNode(SyntaxKind.ImportType); node.argument = argument; node.assertions = assertions; + node.attributes = attributes; node.qualifier = qualifier; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.isTypeOf = isTypeOf; @@ -2663,16 +2675,18 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode node: ImportTypeNode, argument: TypeNode, assertions: ImportTypeAssertionContainer | undefined, + attributes: ImportTypeAttributes | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf: boolean = node.isTypeOf, ): ImportTypeNode { return node.argument !== argument + || node.attributes !== attributes || node.assertions !== assertions || node.qualifier !== qualifier || node.typeArguments !== typeArguments || node.isTypeOf !== isTypeOf - ? update(createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf), node) + ? update(createImportTypeNode(argument, assertions, attributes, qualifier, typeArguments, isTypeOf), node) : node; } @@ -4697,12 +4711,14 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined, + attributes: ImportAttributes | undefined, ): ImportDeclaration { const node = createBaseNode(SyntaxKind.ImportDeclaration); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; node.assertClause = assertClause; + node.attributes = attributes; node.transformFlags |= propagateChildFlags(node.importClause) | propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // always parsed in an Await context @@ -4718,12 +4734,14 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined, + attributes: ImportAttributes | undefined, ) { return node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier || node.assertClause !== assertClause - ? update(createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause), node) + || node.attributes !== attributes + ? update(createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause, attributes), node) : node; } @@ -4801,6 +4819,56 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode : node; } + // @api + function createImportTypeAttributes(attributes: ImportAttributes, multiLine?: boolean): ImportTypeAttributes { + const node = createBaseNode(SyntaxKind.ImportTypeAttributes); + node.attributes = attributes; + node.multiLine = multiLine; + return node; + } + + // @api + function updateImportTypeAttributes(node: ImportTypeAttributes, attributes: ImportAttributes, multiLine?: boolean): ImportTypeAttributes { + return node.attributes !== attributes + || node.multiLine !== multiLine + ? update(createImportTypeAttributes(attributes, multiLine), node) + : node; + } + + // @api + function createImportAttributes(elements: readonly ImportAttribute[], multiLine?: boolean): ImportAttributes { + const node = createBaseNode(SyntaxKind.ImportAttributes); + node.elements = createNodeArray(elements); + node.multiLine = multiLine; + node.transformFlags |= TransformFlags.ContainsESNext; + return node; + } + + // @api + function updateImportAttributes(node: ImportAttributes, elements: readonly ImportAttribute[], multiLine?: boolean): ImportAttributes { + return node.elements !== elements + || node.multiLine !== multiLine + ? update(createImportAttributes(elements, multiLine), node) + : node; + } + + // @api + function createImportAttribute(name: ImportAttributeName, value: Expression): ImportAttribute { + const node = createBaseNode(SyntaxKind.ImportAttribute); + node.name = name; + node.value = value; + node.transformFlags |= TransformFlags.ContainsESNext; + return node; + } + + // @api + function updateImportAttribute(node: ImportAttribute, name: ImportAttributeName, value: Expression): ImportAttribute { + return node.name !== name + || node.value !== value + ? update(createImportAttribute(name, value), node) + : node; + } + // @api function createNamespaceImport(name: Identifier): NamespaceImport { const node = createBaseDeclaration(SyntaxKind.NamespaceImport); @@ -4909,6 +4977,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause, + attributes?: ImportAttributes, ) { const node = createBaseDeclaration(SyntaxKind.ExportDeclaration); node.modifiers = asNodeArray(modifiers); @@ -4916,6 +4985,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode node.exportClause = exportClause; node.moduleSpecifier = moduleSpecifier; node.assertClause = assertClause; + node.attributes = attributes; node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.exportClause) | propagateChildFlags(node.moduleSpecifier); @@ -4933,13 +5003,15 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined, + attributes: ImportAttributes | undefined, ) { return node.modifiers !== modifiers || node.isTypeOnly !== isTypeOnly || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier || node.assertClause !== assertClause - ? finishUpdateExportDeclaration(createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause), node) + || node.attributes !== attributes + ? finishUpdateExportDeclaration(createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause, attributes), node) : node; } @@ -7084,9 +7156,9 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : - isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.assertClause) : + isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.assertClause, node.attributes) : isExportAssignment(node) ? updateExportAssignment(node, modifierArray, node.expression) : - isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause) : + isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause, node.attributes) : Debug.assertNever(node); } diff --git a/src/compiler/factory/nodeTests.ts b/src/compiler/factory/nodeTests.ts index ffc8c4a44839d..fb9a305c4b364 100644 --- a/src/compiler/factory/nodeTests.ts +++ b/src/compiler/factory/nodeTests.ts @@ -67,12 +67,15 @@ import { HeritageClause, Identifier, IfStatement, + ImportAttribute, + ImportAttributes, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportExpression, ImportSpecifier, ImportTypeAssertionContainer, + ImportTypeAttributes, ImportTypeNode, IndexedAccessTypeNode, IndexSignatureDeclaration, @@ -847,14 +850,28 @@ export function isImportTypeAssertionContainer(node: Node): node is ImportTypeAs return node.kind === SyntaxKind.ImportTypeAssertionContainer; } +export function isImportTypeAttributes(node: Node): node is ImportTypeAttributes { + return node.kind === SyntaxKind.ImportTypeAttributes; +} + +/** @deprecated */ export function isAssertClause(node: Node): node is AssertClause { return node.kind === SyntaxKind.AssertClause; } +/** @deprecated */ export function isAssertEntry(node: Node): node is AssertEntry { return node.kind === SyntaxKind.AssertEntry; } +export function isImportAttributes(node: Node): node is ImportAttributes { + return node.kind === SyntaxKind.ImportAttributes; +} + +export function isImportAttribute(node: Node): node is ImportAttribute { + return node.kind === SyntaxKind.ImportAttribute; +} + export function isNamespaceImport(node: Node): node is NamespaceImport { return node.kind === SyntaxKind.NamespaceImport; } diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index 23f8014586d5f..3ba17063ecaf5 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -755,6 +755,7 @@ export function createExternalHelpersImportDeclarationIfNeeded(nodeFactory: Node nodeFactory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, namedBindings), nodeFactory.createStringLiteral(externalHelpersModuleNameText), /*assertClause*/ undefined, + /*attributes*/ undefined, ); addInternalEmitFlags(externalHelpersImportDeclaration, InternalEmitFlags.NeverApplyImportHelper); return externalHelpersImportDeclaration; diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 08a70b437a973..335053808f42a 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -117,12 +117,15 @@ import { Identifier, idText, IfStatement, + ImportAttribute, + ImportAttributes, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportOrExportSpecifier, ImportSpecifier, ImportTypeAssertionContainer, + ImportTypeAttributes, ImportTypeNode, IndexedAccessTypeNode, IndexSignatureDeclaration, @@ -692,12 +695,16 @@ const forEachChildTable: ForEachChildTable = { [SyntaxKind.ImportType]: function forEachChildInImportType(node: ImportTypeNode, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { return visitNode(cbNode, node.argument) || visitNode(cbNode, node.assertions) || + visitNode(cbNode, node.attributes) || visitNode(cbNode, node.qualifier) || visitNodes(cbNode, cbNodes, node.typeArguments); }, [SyntaxKind.ImportTypeAssertionContainer]: function forEachChildInImportTypeAssertionContainer(node: ImportTypeAssertionContainer, cbNode: (node: Node) => T | undefined, _cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { return visitNode(cbNode, node.assertClause); }, + [SyntaxKind.ImportTypeAttributes]: function forEachChildInImportTypeAttributes(node: ImportTypeAttributes, cbNode: (node: Node) => T | undefined, _cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { + return visitNode(cbNode, node.attributes); + }, [SyntaxKind.ParenthesizedType]: forEachChildInParenthesizedTypeOrTypeOperator, [SyntaxKind.TypeOperator]: forEachChildInParenthesizedTypeOrTypeOperator, [SyntaxKind.IndexedAccessType]: function forEachChildInIndexedAccessType(node: IndexedAccessTypeNode, cbNode: (node: Node) => T | undefined, _cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { @@ -930,7 +937,8 @@ const forEachChildTable: ForEachChildTable = { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); + visitNode(cbNode, node.assertClause) || + visitNode(cbNode, node.attributes); }, [SyntaxKind.ImportClause]: function forEachChildInImportClause(node: ImportClause, cbNode: (node: Node) => T | undefined, _cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { return visitNode(cbNode, node.name) || @@ -943,6 +951,13 @@ const forEachChildTable: ForEachChildTable = { return visitNode(cbNode, node.name) || visitNode(cbNode, node.value); }, + [SyntaxKind.ImportAttributes]: function forEachChildInImportAttributes(node: ImportAttributes, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { + return visitNodes(cbNode, cbNodes, node.elements); + }, + [SyntaxKind.ImportAttribute]: function forEachChildInImportAttribute(node: ImportAttribute, cbNode: (node: Node) => T | undefined, _cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.value); + }, [SyntaxKind.NamespaceExportDeclaration]: function forEachChildInNamespaceExportDeclaration(node: NamespaceExportDeclaration, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name); @@ -959,7 +974,8 @@ const forEachChildTable: ForEachChildTable = { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); + visitNode(cbNode, node.assertClause) || + visitNode(cbNode, node.attributes); }, [SyntaxKind.ImportSpecifier]: forEachChildInImportOrExportSpecifier, [SyntaxKind.ExportSpecifier]: forEachChildInImportOrExportSpecifier, @@ -2835,6 +2851,8 @@ namespace Parser { return token() === SyntaxKind.OpenBracketToken || token() === SyntaxKind.DotDotDotToken || isLiteralPropertyName(); case ParsingContext.AssertEntries: return isAssertionKey(); + case ParsingContext.ImportAttributes: + return isLiteralPropertyName(); 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. @@ -2966,6 +2984,7 @@ namespace Parser { case ParsingContext.ObjectBindingElements: case ParsingContext.ImportOrExportSpecifiers: case ParsingContext.AssertEntries: + case ParsingContext.ImportAttributes: return token() === SyntaxKind.CloseBraceToken; case ParsingContext.SwitchClauseStatements: return token() === SyntaxKind.CloseBraceToken || token() === SyntaxKind.CaseKeyword || token() === SyntaxKind.DefaultKeyword; @@ -3430,6 +3449,8 @@ namespace Parser { return parseErrorAtCurrentToken(Diagnostics.Identifier_expected); case ParsingContext.AssertEntries: return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected); // AssertionKey. + case ParsingContext.ImportAttributes: + return parseErrorAtCurrentToken(Diagnostics.Identifier_string_literal_or_number_literal_expected); // ImportAttributeName case ParsingContext.JSDocComment: return parseErrorAtCurrentToken(Diagnostics.Identifier_expected); case ParsingContext.Count: @@ -4498,26 +4519,22 @@ namespace Parser { return token() === SyntaxKind.ImportKeyword; } - function parseImportTypeAssertions(): ImportTypeAssertionContainer { - const pos = getNodePos(); - const openBracePosition = scanner.getTokenStart(); - parseExpected(SyntaxKind.OpenBraceToken); - const multiLine = scanner.hasPrecedingLineBreak(); + function parseImportTypeAssertions(pos: number, openBracePosition: number, multiLine: boolean): ImportTypeAssertionContainer { parseExpected(SyntaxKind.AssertKeyword); parseExpected(SyntaxKind.ColonToken); const clause = parseAssertClause(/*skipAssertKeyword*/ true); - if (!parseExpected(SyntaxKind.CloseBraceToken)) { - const lastError = lastOrUndefined(parseDiagnostics); - if (lastError && lastError.code === Diagnostics._0_expected.code) { - addRelatedInfo( - lastError, - createDetachedDiagnostic(fileName, sourceText, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"), - ); - } - } + parseExpectedCloseBrace(openBracePosition); return finishNode(factory.createImportTypeAssertionContainer(clause, multiLine), pos); } + function parseImportTypeAttributes(pos: number, openBracePosition: number, multiLine: boolean): ImportTypeAttributes { + parseExpected(SyntaxKind.WithKeyword); + parseExpected(SyntaxKind.ColonToken); + const attributes = parseImportAttributes(/*skipWithKeyword*/ true); + parseExpectedCloseBrace(openBracePosition); + return finishNode(factory.createImportTypeAttributes(attributes, multiLine), pos); + } + function parseImportType(): ImportTypeNode { sourceFlags |= NodeFlags.PossiblyContainsDynamicImport; const pos = getNodePos(); @@ -4526,13 +4543,35 @@ namespace Parser { parseExpected(SyntaxKind.OpenParenToken); const type = parseType(); let assertions: ImportTypeAssertionContainer | undefined; + let attributes: ImportTypeAttributes | undefined; if (parseOptional(SyntaxKind.CommaToken)) { - assertions = parseImportTypeAssertions(); + const startPos = getNodePos(); + const openBracePos = scanner.getTokenStart(); + parseExpected(SyntaxKind.OpenBraceToken); + const multiLine = scanner.hasPrecedingLineBreak(); + if (token() === SyntaxKind.AssertKeyword) { + assertions = parseImportTypeAssertions(startPos, openBracePos, multiLine); + } + else { + attributes = parseImportTypeAttributes(startPos, openBracePos, multiLine); + } } parseExpected(SyntaxKind.CloseParenToken); const qualifier = parseOptional(SyntaxKind.DotToken) ? parseEntityNameOfTypeReference() : undefined; const typeArguments = parseTypeArgumentsOfTypeReference(); - return finishNode(factory.createImportTypeNode(type, assertions, qualifier, typeArguments, isTypeOf), pos); + return finishNode(factory.createImportTypeNode(type, assertions, attributes, qualifier, typeArguments, isTypeOf), pos); + } + + function parseExpectedCloseBrace(pos: number) { + if (!parseExpected(SyntaxKind.CloseBraceToken)) { + const lastError = lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === Diagnostics._0_expected.code) { + addRelatedInfo( + lastError, + createDetachedDiagnostic(fileName, sourceText, pos, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"), + ); + } + } } function nextTokenIsNumericOrBigIntLiteral() { @@ -8342,14 +8381,16 @@ namespace Parser { parseExpected(SyntaxKind.FromKeyword); } const moduleSpecifier = parseModuleSpecifier(); - let assertClause: AssertClause | undefined; if (token() === SyntaxKind.AssertKeyword && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } - + let attributes: ImportAttributes | undefined; + if (assertClause === undefined && token() === SyntaxKind.WithKeyword) { + attributes = parseImportAttributes(); + } parseSemicolon(); - const node = factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause); + const node = factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause, attributes); return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -8387,6 +8428,46 @@ namespace Parser { } } + function parseImportAttributeName() { + if (token() === SyntaxKind.StringLiteral || token() === SyntaxKind.NumericLiteral) { + return parseLiteralLikeNode(token()) as StringLiteral | NumericLiteral; + } + return parseIdentifierName(); + } + + function parseImportAttribute() { + const pos = getNodePos(); + const name = parseImportAttributeName(); + parseExpected(SyntaxKind.ColonToken); + return finishNode(factory.createImportAttribute(name, parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true)), pos); + } + + function parseImportAttributes(skipWithKeyword?: true) { + const pos = getNodePos(); + if (!skipWithKeyword) { + parseExpected(SyntaxKind.WithKeyword); + } + const openBracePosition = scanner.getTokenStart(); + if (parseExpected(SyntaxKind.OpenBraceToken)) { + const multiLine = scanner.hasPrecedingLineBreak(); + const elements = parseDelimitedList(ParsingContext.ImportAttributes, parseImportAttribute, /*considerSemicolonAsDelimiter*/ true); + if (!parseExpected(SyntaxKind.CloseBraceToken)) { + const lastError = lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === Diagnostics._0_expected.code) { + addRelatedInfo( + lastError, + createDetachedDiagnostic(fileName, sourceText, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"), + ); + } + } + return finishNode(factory.createImportAttributes(elements, multiLine), pos); + } + else { + const elements = createNodeArray([], getNodePos(), /*end*/ undefined, /*hasTrailingComma*/ false); + return finishNode(factory.createImportAttributes(elements, /*multiLine*/ false), pos); + } + } + function tokenAfterImportDefinitelyProducesImportDeclaration() { return token() === SyntaxKind.AsteriskToken || token() === SyntaxKind.OpenBraceToken; } @@ -8587,6 +8668,7 @@ namespace Parser { let exportClause: NamedExportBindings | undefined; let moduleSpecifier: Expression | undefined; let assertClause: AssertClause | undefined; + let attributes: ImportAttributes | undefined; const isTypeOnly = parseOptional(SyntaxKind.TypeKeyword); const namespaceExportPos = getNodePos(); if (parseOptional(SyntaxKind.AsteriskToken)) { @@ -8609,9 +8691,12 @@ namespace Parser { if (moduleSpecifier && token() === SyntaxKind.AssertKeyword && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } + if (assertClause === undefined && moduleSpecifier && token() === SyntaxKind.WithKeyword) { + attributes = parseImportAttributes(); + } parseSemicolon(); setAwaitContext(savedAwaitContext); - const node = factory.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause); + const node = factory.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause, attributes); return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -8658,9 +8743,10 @@ namespace Parser { 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, - AssertEntries, // Import entries list. + /** @deprecated */ AssertEntries, // Import entries list + ImportAttributes, // Import attributes JSDocComment, // Parsing via JSDocParser - Count, // Number of parsing contexts + Count, // Number of parsing contexts } const enum Tristate { diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 9e8af35bf4e62..5963b9cb543b5 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -168,6 +168,7 @@ import { HeritageClause, Identifier, identity, + ImportAttributes, ImportClause, ImportDeclaration, ImportOrExportSpecifier, @@ -189,6 +190,7 @@ import { isExternalModule, isExternalModuleNameRelative, isIdentifierText, + isImportAttributes, isImportCall, isImportDeclaration, isImportEqualsDeclaration, @@ -897,14 +899,14 @@ export function getModeForUsageLocation(file: { impliedNodeFormat?: ResolutionMo if ((isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent))) { const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent); if (isTypeOnly) { - const override = getResolutionModeOverrideForClause(usage.parent.assertClause); + const override = getResolutionModeOverride(usage.parent.assertClause); if (override) { return override; } } } if (usage.parent.parent && isImportTypeNode(usage.parent.parent)) { - const override = getResolutionModeOverrideForClause(usage.parent.parent.assertions?.assertClause); + const override = getResolutionModeOverride(usage.parent.parent.assertions?.assertClause); if (override) { return override; } @@ -920,16 +922,26 @@ export function getModeForUsageLocation(file: { impliedNodeFormat?: ResolutionMo } /** @internal */ -export function getResolutionModeOverrideForClause(clause: AssertClause | undefined, grammarErrorOnNode?: (node: Node, diagnostic: DiagnosticMessage) => void) { - if (!clause) return undefined; - if (length(clause.elements) !== 1) { - grammarErrorOnNode?.(clause, Diagnostics.Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require); +export function getResolutionModeOverride(node: AssertClause | ImportAttributes | undefined, grammarErrorOnNode?: (node: Node, diagnostic: DiagnosticMessage) => void) { + if (!node) return undefined; + if (length(node.elements) !== 1) { + grammarErrorOnNode?.( + node, + isImportAttributes(node) + ? Diagnostics.Type_import_attributes_should_have_exactly_one_key_resolution_mode_with_value_import_or_require + : Diagnostics.Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require, + ); return undefined; } - const elem = clause.elements[0]; + const elem = node.elements[0]; if (!isStringLiteralLike(elem.name)) return undefined; if (elem.name.text !== "resolution-mode") { - grammarErrorOnNode?.(elem.name, Diagnostics.resolution_mode_is_the_only_valid_key_for_type_import_assertions); + grammarErrorOnNode?.( + elem.name, + isImportAttributes(node) + ? Diagnostics.resolution_mode_is_the_only_valid_key_for_type_import_attributes + : Diagnostics.resolution_mode_is_the_only_valid_key_for_type_import_assertions, + ); return undefined; } if (!isStringLiteralLike(elem.value)) return undefined; @@ -1394,7 +1406,7 @@ export const plainJSErrors = new Set([ Diagnostics.Classes_may_not_have_a_field_named_constructor.code, Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code, Diagnostics.Duplicate_label_0.code, - Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments.code, + Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_set_of_attributes_as_arguments.code, Diagnostics.for_await_loops_cannot_be_used_inside_a_class_static_block.code, Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression.code, Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name.code, @@ -3286,7 +3298,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg function createSyntheticImport(text: string, file: SourceFile) { const externalHelpersModuleReference = factory.createStringLiteral(text); - const importDecl = factory.createImportDeclaration(/*modifiers*/ undefined, /*importClause*/ undefined, externalHelpersModuleReference, /*assertClause*/ undefined); + const importDecl = factory.createImportDeclaration(/*modifiers*/ undefined, /*importClause*/ undefined, externalHelpersModuleReference, /*assertClause*/ undefined, /*attributes*/ undefined); addInternalEmitFlags(importDecl, InternalEmitFlags.NeverApplyImportHelper); setParent(externalHelpersModuleReference, importDecl); setParent(importDecl, file); diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 8fb87a7b281d4..465e500b60fd9 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -70,7 +70,7 @@ import { getOutputPathsFor, getParseTreeNode, getRelativePathToDirectoryOrUrl, - getResolutionModeOverrideForClause, + getResolutionModeOverride, getResolvedExternalModuleName, getSetAccessorValueParameter, getSourceFileOfNode, @@ -86,6 +86,7 @@ import { hasSyntacticModifier, HeritageClause, Identifier, + ImportAttributes, ImportDeclaration, ImportEqualsDeclaration, ImportTypeNode, @@ -118,6 +119,7 @@ import { isIdentifier, isIdentifierANonContextualKeyword, isIdentifierText, + isImportAttributes, isImportDeclaration, isImportEqualsDeclaration, isIndexSignatureDeclaration, @@ -984,7 +986,8 @@ export function transformDeclarations(context: TransformationContext) { decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier), - getResolutionModeOverrideForClauseInNightly(decl.assertClause), + getResolutionModeOverrideInNightly(decl.assertClause), + getResolutionModeOverrideInNightly(decl.attributes), ); } // The `importClause` visibility corresponds to the default's visibility. @@ -1001,7 +1004,8 @@ export function transformDeclarations(context: TransformationContext) { /*namedBindings*/ undefined, ), rewriteModuleSpecifier(decl, decl.moduleSpecifier), - getResolutionModeOverrideForClauseInNightly(decl.assertClause), + getResolutionModeOverrideInNightly(decl.assertClause), + getResolutionModeOverrideInNightly(decl.attributes), ); } if (decl.importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { @@ -1017,7 +1021,8 @@ export function transformDeclarations(context: TransformationContext) { namedBindings, ), rewriteModuleSpecifier(decl, decl.moduleSpecifier), - getResolutionModeOverrideForClauseInNightly(decl.assertClause), + getResolutionModeOverrideInNightly(decl.assertClause), + getResolutionModeOverrideInNightly(decl.attributes), ) : undefined; } // Named imports (optionally with visible default) @@ -1033,7 +1038,8 @@ export function transformDeclarations(context: TransformationContext) { bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined, ), rewriteModuleSpecifier(decl, decl.moduleSpecifier), - getResolutionModeOverrideForClauseInNightly(decl.assertClause), + getResolutionModeOverrideInNightly(decl.assertClause), + getResolutionModeOverrideInNightly(decl.attributes), ); } // Augmentation of export depends on import @@ -1043,19 +1049,25 @@ export function transformDeclarations(context: TransformationContext) { decl.modifiers, /*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier), - getResolutionModeOverrideForClauseInNightly(decl.assertClause), + getResolutionModeOverrideInNightly(decl.assertClause), + getResolutionModeOverrideInNightly(decl.attributes), ); } // Nothing visible } - function getResolutionModeOverrideForClauseInNightly(assertClause: AssertClause | undefined) { - const mode = getResolutionModeOverrideForClause(assertClause); - if (mode !== undefined) { + function getResolutionModeOverrideInNightly(node: T | undefined) { + const mode = getResolutionModeOverride(node); + if (node && mode !== undefined) { if (!isNightly()) { - context.addDiagnostic(createDiagnosticForNode(assertClause!, Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next)); + context.addDiagnostic(createDiagnosticForNode( + node, + isImportAttributes(node) + ? Diagnostics.resolution_mode_attributes_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next + : Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, + )); } - return assertClause; + return node; } return undefined; } @@ -1329,6 +1341,7 @@ export function transformDeclarations(context: TransformationContext) { input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, + input.attributes, input.qualifier, visitNodes(input.typeArguments, visitDeclarationSubtree, isTypeNode), input.isTypeOf, @@ -1390,7 +1403,8 @@ export function transformDeclarations(context: TransformationContext) { input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), - getResolutionModeOverrideForClause(input.assertClause) ? input.assertClause : undefined, + getResolutionModeOverrideInNightly(input.assertClause) ? input.assertClause : undefined, + getResolutionModeOverrideInNightly(input.attributes) ? input.attributes : undefined, ); } case SyntaxKind.ExportAssignment: { diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index d0e191d537ad0..ff2e0e30f91e1 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -170,7 +170,7 @@ export function transformJsx(context: TransformationContext): (x: SourceFile | B for (const [importSource, importSpecifiersMap] of arrayFrom(currentFileState.utilizedImplicitRuntimeImports.entries())) { if (isExternalModule(node)) { // Add `import` statement - const importStatement = factory.createImportDeclaration(/*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, factory.createNamedImports(arrayFrom(importSpecifiersMap.values()))), factory.createStringLiteral(importSource), /*assertClause*/ undefined); + const importStatement = factory.createImportDeclaration(/*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, factory.createNamedImports(arrayFrom(importSpecifiersMap.values()))), factory.createStringLiteral(importSource), /*assertClause*/ undefined, /*attributes*/ undefined); setParentRecursive(importStatement, /*incremental*/ false); statements = insertStatementAfterCustomPrologue(statements.slice(), importStatement); } diff --git a/src/compiler/transformers/module/esnextAnd2015.ts b/src/compiler/transformers/module/esnextAnd2015.ts index 9e41ffc75de04..ffc283307f733 100644 --- a/src/compiler/transformers/module/esnextAnd2015.ts +++ b/src/compiler/transformers/module/esnextAnd2015.ts @@ -159,6 +159,8 @@ export function transformECMAScriptModule(context: TransformationContext): (x: S ]), ), factory.createStringLiteral("module"), + /*assertClause*/ undefined, + /*attributes*/ undefined, ); const requireHelperName = factory.createUniqueName("__require", GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel); const requireStatement = factory.createVariableStatement( @@ -266,6 +268,7 @@ export function transformECMAScriptModule(context: TransformationContext): (x: S ), node.moduleSpecifier, node.assertClause, + node.attributes, ); setOriginalNode(importDecl, node.exportClause); diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 00eb218342e00..52f81f174d0f6 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -2228,6 +2228,7 @@ export function transformTypeScript(context: TransformationContext) { importClause, node.moduleSpecifier, node.assertClause, + node.attributes, ) : undefined; } @@ -2324,6 +2325,7 @@ export function transformTypeScript(context: TransformationContext) { exportClause, node.moduleSpecifier, node.assertClause, + node.attributes, ) : undefined; } @@ -2394,6 +2396,7 @@ export function transformTypeScript(context: TransformationContext) { /*importClause*/ undefined, node.moduleReference.expression, /*assertClause*/ undefined, + /*attributes*/ undefined, ), node, ), diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 14575e7f1733d..33ddec5267e99 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -376,9 +376,12 @@ export const enum SyntaxKind { DefaultClause, HeritageClause, CatchClause, - AssertClause, - AssertEntry, - ImportTypeAssertionContainer, + /** @deprecated */ AssertClause, + /** @deprecated */ AssertEntry, + /** @deprecated */ ImportTypeAssertionContainer, + ImportAttributes, + ImportAttribute, + ImportTypeAttributes, // Property assignments PropertyAssignment, @@ -1057,6 +1060,7 @@ export type HasChildren = | InferTypeNode | ImportTypeNode | ImportTypeAssertionContainer + | ImportTypeAttributes | NamedTupleMember | ParenthesizedTypeNode | TypeOperatorNode @@ -1129,6 +1133,8 @@ export type HasChildren = | ImportDeclaration | AssertClause | AssertEntry + | ImportAttributes + | ImportAttribute | ImportClause | NamespaceImport | NamespaceExport @@ -2141,6 +2147,7 @@ export interface KeywordTypeNode; + readonly multiLine?: boolean; +} + export interface NamespaceImport extends NamedDeclaration { readonly kind: SyntaxKind.NamespaceImport; readonly parent: ImportClause; @@ -3672,7 +3707,8 @@ export interface ExportDeclaration extends DeclarationStatement, JSDocContainer readonly exportClause?: NamedExportBindings; /** If this is not a StringLiteral it will be a grammar error. */ readonly moduleSpecifier?: Expression; - readonly assertClause?: AssertClause; + /** @deprecated */ readonly assertClause?: AssertClause; + readonly attributes?: ImportAttributes; } export interface NamedImports extends Node { @@ -8393,8 +8429,8 @@ export interface NodeFactory { updateConditionalTypeNode(node: ConditionalTypeNode, checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode; createInferTypeNode(typeParameter: TypeParameterDeclaration): InferTypeNode; updateInferTypeNode(node: InferTypeNode, typeParameter: TypeParameterDeclaration): InferTypeNode; - createImportTypeNode(argument: TypeNode, assertions?: ImportTypeAssertionContainer, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; - updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, assertions: ImportTypeAssertionContainer | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode; + createImportTypeNode(argument: TypeNode, assertions?: ImportTypeAssertionContainer, attributes?: ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; + updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, assertions: ImportTypeAssertionContainer | undefined, attributes: ImportTypeAttributes | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode; createParenthesizedType(type: TypeNode): ParenthesizedTypeNode; updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode; createThisTypeNode(): ThisTypeNode; @@ -8574,16 +8610,22 @@ export interface NodeFactory { updateNamespaceExportDeclaration(node: NamespaceExportDeclaration, name: Identifier): NamespaceExportDeclaration; createImportEqualsDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; updateImportEqualsDeclaration(node: ImportEqualsDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; - createImportDeclaration(modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration; - updateImportDeclaration(node: ImportDeclaration, modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration; + createImportDeclaration(modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause, attributes?: ImportAttributes): ImportDeclaration; + updateImportDeclaration(node: ImportDeclaration, modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined, attributes: ImportAttributes | 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, multiLine?: boolean): AssertClause; - updateAssertClause(node: AssertClause, elements: NodeArray, multiLine?: boolean): AssertClause; - createAssertEntry(name: AssertionKey, value: Expression): AssertEntry; - updateAssertEntry(node: AssertEntry, name: AssertionKey, value: Expression): AssertEntry; - createImportTypeAssertionContainer(clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; - updateImportTypeAssertionContainer(node: ImportTypeAssertionContainer, clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; + /** @deprecated */ createAssertClause(elements: NodeArray, multiLine?: boolean): AssertClause; + /** @deprecated */ updateAssertClause(node: AssertClause, elements: NodeArray, multiLine?: boolean): AssertClause; + /** @deprecated */ createAssertEntry(name: AssertionKey, value: Expression): AssertEntry; + /** @deprecated */ updateAssertEntry(node: AssertEntry, name: AssertionKey, value: Expression): AssertEntry; + /** @deprecated */ createImportTypeAssertionContainer(clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; + /** @deprecated */ updateImportTypeAssertionContainer(node: ImportTypeAssertionContainer, clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; + createImportAttributes(elements: NodeArray, multiLine?: boolean): ImportAttributes; + updateImportAttributes(node: ImportAttributes, elements: NodeArray, multiLine?: boolean): ImportAttributes; + createImportAttribute(name: ImportAttributeName, value: Expression): ImportAttribute; + updateImportAttribute(node: ImportAttribute, name: ImportAttributeName, value: Expression): ImportAttribute; + createImportTypeAttributes(attributes: ImportAttributes, multiLine?: boolean): ImportTypeAttributes; + updateImportTypeAttributes(node: ImportTypeAttributes, attributes: ImportAttributes, multiLine?: boolean): ImportTypeAttributes; createNamespaceImport(name: Identifier): NamespaceImport; updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport; createNamespaceExport(name: Identifier): NamespaceExport; @@ -8594,8 +8636,8 @@ export interface NodeFactory { updateImportSpecifier(node: ImportSpecifier, isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; createExportAssignment(modifiers: readonly ModifierLike[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment; updateExportAssignment(node: ExportAssignment, modifiers: readonly ModifierLike[] | undefined, expression: Expression): ExportAssignment; - createExportDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration; - updateExportDeclaration(node: ExportDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration; + createExportDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause, attributes?: ImportAttributes): ExportDeclaration; + updateExportDeclaration(node: ExportDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined, attributes: ImportAttributes | undefined): ExportDeclaration; createNamedExports(elements: readonly ExportSpecifier[]): NamedExports; updateNamedExports(node: NamedExports, elements: readonly ExportSpecifier[]): NamedExports; createExportSpecifier(isTypeOnly: boolean, propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier; @@ -9724,7 +9766,8 @@ export const enum ListFormat { 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, + /** @deprecated */ ImportClauseEntries = PreserveLines | CommaDelimited | SpaceBetweenSiblings | SpaceBetweenBraces | Indented | Braces | NoSpaceIfEmpty, + ImportAttributes = PreserveLines | CommaDelimited | SpaceBetweenSiblings | SpaceBetweenBraces | Indented | Braces | NoSpaceIfEmpty, ArrayLiteralExpressionElements = PreserveLines | CommaDelimited | SpaceBetweenSiblings | AllowTrailingComma | Indented | SquareBrackets, CommaListElements = CommaDelimited | SpaceBetweenSiblings | SingleLine, CallExpressionArguments = CommaDelimited | SpaceBetweenSiblings | SingleLine | Parenthesis, diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 02b2278e93b5d..f8dd89a5cd93e 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -193,6 +193,7 @@ import { getPathComponents, getPathFromPathComponents, getRelativePathToDirectoryOrUrl, + getResolutionModeOverride, getRootLength, getSnippetElement, getStringComparer, @@ -10435,3 +10436,13 @@ export function getPropertyNameFromType(type: StringLiteralType | NumberLiteralT } return Debug.fail(); } + +/** @intre */ +export function hasResolutionModeOverride(node: ImportTypeNode | ImportDeclaration | ExportDeclaration | undefined) { + if (node === undefined) { + return false; + } + const assertClause = isImportTypeNode(node) ? node.assertions?.assertClause : node.assertClause; + const attributes = isImportTypeNode(node) ? node.attributes?.attributes : node.attributes; + return !!getResolutionModeOverride(attributes || assertClause); +} diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 56ee00f89a04c..6b736990594e2 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -92,6 +92,7 @@ import { hasSyntacticModifier, HasType, Identifier, + ImportAttributeName, ImportClause, ImportEqualsDeclaration, ImportSpecifier, @@ -146,6 +147,7 @@ import { isModuleBlock, isNonNullExpression, isNotEmittedStatement, + isNumericLiteral, isOmittedExpression, isParameter, isPartiallyEmittedExpression, @@ -1526,6 +1528,10 @@ export function isStringTextContainingNode(node: Node): node is StringLiteral | return node.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(node.kind); } +export function isImportAttributeName(node: Node): node is ImportAttributeName { + return isStringLiteral(node) || isIdentifier(node) || isNumericLiteral(node); +} + // Identifiers /** @internal */ diff --git a/src/compiler/visitorPublic.ts b/src/compiler/visitorPublic.ts index 109614c3244b2..30790eefb9819 100644 --- a/src/compiler/visitorPublic.ts +++ b/src/compiler/visitorPublic.ts @@ -42,9 +42,13 @@ import { isHeritageClause, isIdentifier, isIdentifierOrThisTypeNode, + isImportAttribute, + isImportAttributeName, + isImportAttributes, isImportClause, isImportSpecifier, isImportTypeAssertionContainer, + isImportTypeAttributes, isJsxAttributeLike, isJsxAttributeName, isJsxAttributes, @@ -895,12 +899,21 @@ const visitEachChildTable: VisitEachChildTable = { node, Debug.checkDefined(nodeVisitor(node.argument, visitor, isTypeNode)), nodeVisitor(node.assertions, visitor, isImportTypeAssertionContainer), + nodeVisitor(node.attributes, visitor, isImportTypeAttributes), nodeVisitor(node.qualifier, visitor, isEntityName), nodesVisitor(node.typeArguments, visitor, isTypeNode), node.isTypeOf, ); }, + [SyntaxKind.ImportTypeAttributes]: function visitEachChildOfImportTypeAttributes(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeAttributes( + node, + Debug.checkDefined(nodeVisitor(node.attributes, visitor, isImportAttributes)), + node.multiLine, + ); + }, + [SyntaxKind.ImportTypeAssertionContainer]: function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateImportTypeAssertionContainer( node, @@ -1525,6 +1538,7 @@ const visitEachChildTable: VisitEachChildTable = { nodeVisitor(node.importClause, visitor, isImportClause), Debug.checkDefined(nodeVisitor(node.moduleSpecifier, visitor, isExpression)), nodeVisitor(node.assertClause, visitor, isAssertClause), + nodeVisitor(node.attributes, visitor, isImportAttributes), ); }, @@ -1544,6 +1558,22 @@ const visitEachChildTable: VisitEachChildTable = { ); }, + [SyntaxKind.ImportAttributes]: function visitEachChildOfImportAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateImportAttributes( + node, + nodesVisitor(node.elements, visitor, isImportAttribute), + node.multiLine, + ); + }, + + [SyntaxKind.ImportAttribute]: function visitEachChildOfImportAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportAttribute( + node, + Debug.checkDefined(nodeVisitor(node.name, visitor, isImportAttributeName)), + Debug.checkDefined(nodeVisitor(node.value, visitor, isExpression)), + ); + }, + [SyntaxKind.ImportClause]: function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateImportClause( node, @@ -1599,6 +1629,7 @@ const visitEachChildTable: VisitEachChildTable = { nodeVisitor(node.exportClause, visitor, isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, isExpression), nodeVisitor(node.assertClause, visitor, isAssertClause), + nodeVisitor(node.attributes, visitor, isImportAttributes), ); }, diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index 6a15ca0a3ff09..aee3dba3e8575 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -1133,6 +1133,7 @@ export namespace Completion { interfaceEntry("ImportMeta"), interfaceEntry("ImportCallOptions"), interfaceEntry("ImportAssertions"), + interfaceEntry("ImportAttributes"), varEntry("Math"), varEntry("Date"), interfaceEntry("DateConstructor"), diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 988751cd338b3..8065e2d3de83c 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -620,7 +620,8 @@ interface ImportMeta { * augmented via interface merging. */ interface ImportCallOptions { - assert?: ImportAssertions; + /** @deprecated*/ assert?: ImportAssertions; + with?: ImportAttributes; } /** @@ -630,6 +631,13 @@ interface ImportAssertions { [key: string]: string; } +/** + * The type for the `with` property of the optional second argument to `import()`. + */ +interface ImportAttributes { + [key: string]: string; +} + interface Math { /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ readonly E: number; diff --git a/src/services/codefixes/convertToTypeOnlyExport.ts b/src/services/codefixes/convertToTypeOnlyExport.ts index 36a75c5ddefaa..f67151547f1b8 100644 --- a/src/services/codefixes/convertToTypeOnlyExport.ts +++ b/src/services/codefixes/convertToTypeOnlyExport.ts @@ -69,6 +69,7 @@ function fixSingleExportDeclaration(changes: textChanges.ChangeTracker, exportSp factory.updateNamedExports(exportClause, filter(exportClause.elements, e => !contains(typeExportSpecifiers, e))), exportDeclaration.moduleSpecifier, /*assertClause*/ undefined, + /*attributes*/ undefined, ); const typeExportDeclaration = factory.createExportDeclaration( /*modifiers*/ undefined, @@ -76,6 +77,7 @@ function fixSingleExportDeclaration(changes: textChanges.ChangeTracker, exportSp factory.createNamedExports(typeExportSpecifiers), exportDeclaration.moduleSpecifier, /*assertClause*/ undefined, + /*attributes*/ undefined, ); changes.replaceNode(context.sourceFile, exportDeclaration, valueExportDeclaration, { diff --git a/src/services/codefixes/convertToTypeOnlyImport.ts b/src/services/codefixes/convertToTypeOnlyImport.ts index 5578ddc5d6902..210eb3bfe50e4 100644 --- a/src/services/codefixes/convertToTypeOnlyImport.ts +++ b/src/services/codefixes/convertToTypeOnlyImport.ts @@ -126,12 +126,14 @@ function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, de factory.createImportClause(/*isTypeOnly*/ true, getSynthesizedDeepClone(importClause.name, /*includeTrivia*/ true), /*namedBindings*/ undefined), getSynthesizedDeepClone(declaration.moduleSpecifier, /*includeTrivia*/ true), getSynthesizedDeepClone(declaration.assertClause, /*includeTrivia*/ true), + getSynthesizedDeepClone(declaration.attributes, /*includeTrivia*/ true), ), factory.createImportDeclaration( getSynthesizedDeepClones(declaration.modifiers, /*includeTrivia*/ true), factory.createImportClause(/*isTypeOnly*/ true, /*name*/ undefined, getSynthesizedDeepClone(importClause.namedBindings, /*includeTrivia*/ true)), getSynthesizedDeepClone(declaration.moduleSpecifier, /*includeTrivia*/ true), getSynthesizedDeepClone(declaration.assertClause, /*includeTrivia*/ true), + getSynthesizedDeepClone(declaration.attributes, /*includeTrivia*/ true), ), ]); } @@ -142,7 +144,7 @@ function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, de sameMap(importClause.namedBindings.elements, e => factory.updateImportSpecifier(e, /*isTypeOnly*/ false, e.propertyName, e.name)), ) : importClause.namedBindings; - const importDeclaration = factory.updateImportDeclaration(declaration, declaration.modifiers, factory.updateImportClause(importClause, /*isTypeOnly*/ true, importClause.name, newNamedBindings), declaration.moduleSpecifier, declaration.assertClause); + const importDeclaration = factory.updateImportDeclaration(declaration, declaration.modifiers, factory.updateImportClause(importClause, /*isTypeOnly*/ true, importClause.name, newNamedBindings), declaration.moduleSpecifier, declaration.assertClause, declaration.attributes); changes.replaceNode(sourceFile, declaration, importDeclaration); } } diff --git a/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts b/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts index 830e76d60f9c8..12ff253cd522e 100644 --- a/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts +++ b/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts @@ -38,6 +38,6 @@ function getImportTypeNode(sourceFile: SourceFile, pos: number): ImportTypeNode } function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, importType: ImportTypeNode) { - const newTypeNode = factory.updateImportTypeNode(importType, importType.argument, importType.assertions, importType.qualifier, importType.typeArguments, /*isTypeOf*/ true); + const newTypeNode = factory.updateImportTypeNode(importType, importType.argument, importType.assertions, importType.attributes, importType.qualifier, importType.typeArguments, /*isTypeOf*/ true); changes.replaceNode(sourceFile, importType, newTypeNode); } diff --git a/src/services/codefixes/fixImportNonExportedMember.ts b/src/services/codefixes/fixImportNonExportedMember.ts index 51202cc8c32e2..7ebda0a72f742 100644 --- a/src/services/codefixes/fixImportNonExportedMember.ts +++ b/src/services/codefixes/fixImportNonExportedMember.ts @@ -186,12 +186,13 @@ function updateExport(changes: textChanges.ChangeTracker, program: Program, sour ), node.moduleSpecifier, node.assertClause, + node.attributes, ), ); } function createExport(changes: textChanges.ChangeTracker, program: Program, sourceFile: SourceFile, names: ExportName[]) { - changes.insertNodeAtEndOfScope(sourceFile, sourceFile, factory.createExportDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, factory.createNamedExports(createExportSpecifiers(names, /*allowTypeModifier*/ getIsolatedModules(program.getCompilerOptions()))), /*moduleSpecifier*/ undefined, /*assertClause*/ undefined)); + changes.insertNodeAtEndOfScope(sourceFile, sourceFile, factory.createExportDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, factory.createNamedExports(createExportSpecifiers(names, /*allowTypeModifier*/ getIsolatedModules(program.getCompilerOptions()))), /*moduleSpecifier*/ undefined, /*assertClause*/ undefined, /*attributes*/ undefined)); } function createExportSpecifiers(names: ExportName[], allowTypeModifier: boolean) { diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 1b0bcd9145d65..840789810b4cc 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -1625,6 +1625,7 @@ function getNewImports( ), quotedModuleSpecifier, /*assertClause*/ undefined, + /*attributes*/ undefined, ); statements = combine(statements, declaration); } diff --git a/src/services/codefixes/requireInTs.ts b/src/services/codefixes/requireInTs.ts index cc22d5e9f0078..d8522a31235ec 100644 --- a/src/services/codefixes/requireInTs.ts +++ b/src/services/codefixes/requireInTs.ts @@ -57,7 +57,7 @@ function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, in statement, defaultImportName && !allowSyntheticDefaults ? factory.createImportEqualsDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, defaultImportName, factory.createExternalModuleReference(required)) - : factory.createImportDeclaration(/*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, defaultImportName, namedImports), required, /*assertClause*/ undefined), + : factory.createImportDeclaration(/*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, defaultImportName, namedImports), required, /*assertClause*/ undefined, /*attributes*/ undefined), ); } diff --git a/src/services/codefixes/splitTypeOnlyImport.ts b/src/services/codefixes/splitTypeOnlyImport.ts index 0b1e2e48e577e..958b260dfe825 100644 --- a/src/services/codefixes/splitTypeOnlyImport.ts +++ b/src/services/codefixes/splitTypeOnlyImport.ts @@ -54,6 +54,7 @@ function splitTypeOnlyImport(changes: textChanges.ChangeTracker, importDeclarati factory.updateImportClause(importClause, importClause.isTypeOnly, importClause.name, /*namedBindings*/ undefined), importDeclaration.moduleSpecifier, importDeclaration.assertClause, + importDeclaration.attributes, ), ); @@ -65,6 +66,7 @@ function splitTypeOnlyImport(changes: textChanges.ChangeTracker, importDeclarati factory.updateImportClause(importClause, importClause.isTypeOnly, /*name*/ undefined, importClause.namedBindings), importDeclaration.moduleSpecifier, importDeclaration.assertClause, + importDeclaration.attributes, ), ); } diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts index 1a5fa964a9c63..a729716ab4596 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -270,6 +270,7 @@ function removeUnusedImports(oldImports: readonly ImportDeclaration[], sourceFil /*importClause*/ undefined, moduleSpecifier, /*assertClause*/ undefined, + /*attributes*/ undefined, )); } // If we're not in a declaration file, we can't remove the import clause even though @@ -531,6 +532,7 @@ function coalesceExportsWorker(exportGroup: readonly ExportDeclaration[], compar ), exportDecl.moduleSpecifier, exportDecl.assertClause, + exportDecl.attributes, ), ); } @@ -580,6 +582,7 @@ function updateImportDeclarationAndClause( factory.updateImportClause(importDeclaration.importClause!, importDeclaration.importClause!.isTypeOnly, name, namedBindings), // TODO: GH#18217 importDeclaration.moduleSpecifier, importDeclaration.assertClause, + importDeclaration.attributes, ); } diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index 91e0573993e08..890d2b0a7dda5 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -12,6 +12,7 @@ import { DefaultClause, findChildOfKind, getLeadingCommentRanges, + ImportAttributes, isAnyImportSyntax, isArrayLiteralExpression, isBinaryExpression, @@ -302,11 +303,12 @@ function getOutliningSpanForNode(n: Node, sourceFile: SourceFile): OutliningSpan return spanForParenthesizedExpression(n as ParenthesizedExpression); case SyntaxKind.NamedImports: case SyntaxKind.NamedExports: + case SyntaxKind.ImportAttributes: case SyntaxKind.AssertClause: - return spanForNamedImportsOrExportsOrAssertClause(n as NamedImports | NamedExports | AssertClause); + return spanForImportExportElements(n as NamedImports | NamedExports | AssertClause | ImportAttributes); } - function spanForNamedImportsOrExportsOrAssertClause(node: NamedImports | NamedExports | AssertClause) { + function spanForImportExportElements(node: NamedImports | NamedExports | AssertClause | ImportAttributes) { if (!node.elements.length) { return undefined; } diff --git a/src/services/refactors/convertExport.ts b/src/services/refactors/convertExport.ts index 342013cdac37b..50b8a42aa79bf 100644 --- a/src/services/refactors/convertExport.ts +++ b/src/services/refactors/convertExport.ts @@ -275,7 +275,7 @@ function changeDefaultToNamedImport(importingSourceFile: SourceFile, ref: Identi } case SyntaxKind.ImportType: const importTypeNode = parent as ImportTypeNode; - changes.replaceNode(importingSourceFile, parent, factory.createImportTypeNode(importTypeNode.argument, importTypeNode.assertions, factory.createIdentifier(exportName), importTypeNode.typeArguments, importTypeNode.isTypeOf)); + changes.replaceNode(importingSourceFile, parent, factory.createImportTypeNode(importTypeNode.argument, importTypeNode.assertions, importTypeNode.attributes, factory.createIdentifier(exportName), importTypeNode.typeArguments, importTypeNode.isTypeOf)); break; default: Debug.failBadSyntaxKind(parent); diff --git a/src/services/refactors/convertImport.ts b/src/services/refactors/convertImport.ts index fdcaccff5773c..47d7314de7139 100644 --- a/src/services/refactors/convertImport.ts +++ b/src/services/refactors/convertImport.ts @@ -280,5 +280,5 @@ function isExportEqualsModule(moduleSpecifier: Expression, checker: TypeChecker) } function updateImport(old: ImportDeclaration, defaultImportName: Identifier | undefined, elements: readonly ImportSpecifier[] | undefined): ImportDeclaration { - return factory.createImportDeclaration(/*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, defaultImportName, elements && elements.length ? factory.createNamedImports(elements) : undefined), old.moduleSpecifier, /*assertClause*/ undefined); + return factory.createImportDeclaration(/*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, defaultImportName, elements && elements.length ? factory.createNamedImports(elements) : undefined), old.moduleSpecifier, /*assertClause*/ undefined, /*attributes*/ undefined); } diff --git a/src/services/refactors/moveToFile.ts b/src/services/refactors/moveToFile.ts index 352c9043b40f4..bc0287edcf2b1 100644 --- a/src/services/refactors/moveToFile.ts +++ b/src/services/refactors/moveToFile.ts @@ -480,6 +480,7 @@ function updateNamespaceLikeImportNode(node: SupportedImport, newNamespaceName: factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, factory.createNamespaceImport(newNamespaceId)), newModuleString, /*assertClause*/ undefined, + /*attributes*/ undefined, ); case SyntaxKind.ImportEqualsDeclaration: return factory.createImportEqualsDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, newNamespaceId, factory.createExternalModuleReference(newModuleString)); @@ -772,7 +773,7 @@ export function filterImport(i: SupportedImport, moduleSpecifier: StringLiteralL const defaultImport = clause.name && keep(clause.name) ? clause.name : undefined; const namedBindings = clause.namedBindings && filterNamedBindings(clause.namedBindings, keep); return defaultImport || namedBindings - ? factory.createImportDeclaration(/*modifiers*/ undefined, factory.createImportClause(clause.isTypeOnly, defaultImport, namedBindings), getSynthesizedDeepClone(moduleSpecifier), /*assertClause*/ undefined) + ? factory.createImportDeclaration(/*modifiers*/ undefined, factory.createImportClause(clause.isTypeOnly, defaultImport, namedBindings), getSynthesizedDeepClone(moduleSpecifier), /*assertClause*/ undefined, /*attributes*/ undefined) : undefined; } case SyntaxKind.ImportEqualsDeclaration: @@ -1198,7 +1199,7 @@ function moveStatementsToTargetFile(changes: textChanges.ChangeTracker, program: } if (length(updatedElements) < length(elements)) { - changes.replaceNode(targetFile, exportDeclaration, factory.updateExportDeclaration(exportDeclaration, exportDeclaration.modifiers, exportDeclaration.isTypeOnly, factory.updateNamedExports(exportDeclaration.exportClause, factory.createNodeArray(updatedElements, elements.hasTrailingComma)), exportDeclaration.moduleSpecifier, exportDeclaration.assertClause)); + changes.replaceNode(targetFile, exportDeclaration, factory.updateExportDeclaration(exportDeclaration, exportDeclaration.modifiers, exportDeclaration.isTypeOnly, factory.updateNamedExports(exportDeclaration.exportClause, factory.createNodeArray(updatedElements, elements.hasTrailingComma)), exportDeclaration.moduleSpecifier, exportDeclaration.assertClause, exportDeclaration.attributes)); } } } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index daf401d496379..27417b52c3d18 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -2502,6 +2502,7 @@ export function makeImport(defaultImport: Identifier | undefined, namedImports: : undefined, typeof moduleSpecifier === "string" ? makeStringLiteral(moduleSpecifier, quotePreference) : moduleSpecifier, /*assertClause*/ undefined, + /*attributes*/ undefined, ); } diff --git a/src/testRunner/unittests/transform.ts b/src/testRunner/unittests/transform.ts index 766a1d9f8ec9a..a6021856579ac 100644 --- a/src/testRunner/unittests/transform.ts +++ b/src/testRunner/unittests/transform.ts @@ -309,7 +309,7 @@ describe("unittests:: TransformAPI", () => { const exports = [{ name: "x" }]; const exportSpecifiers = exports.map(e => ts.factory.createExportSpecifier(/*isTypeOnly*/ false, e.name, e.name)); const exportClause = ts.factory.createNamedExports(exportSpecifiers); - const newEd = ts.factory.updateExportDeclaration(ed, ed.modifiers, ed.isTypeOnly, exportClause, ed.moduleSpecifier, ed.assertClause); + const newEd = ts.factory.updateExportDeclaration(ed, ed.modifiers, ed.isTypeOnly, exportClause, ed.moduleSpecifier, ed.assertClause, ed.attributes); return newEd as ts.Node as T; } @@ -348,6 +348,7 @@ describe("unittests:: TransformAPI", () => { ), /*moduleSpecifier*/ ts.factory.createStringLiteral("./comp1"), /*assertClause*/ undefined, + /*attributes*/ undefined, ); return ts.factory.updateSourceFile(sf, [importStar]); } diff --git a/src/testRunner/unittests/tscWatch/moduleResolution.ts b/src/testRunner/unittests/tscWatch/moduleResolution.ts index 10a7a86a1614b..099d43066f6ba 100644 --- a/src/testRunner/unittests/tscWatch/moduleResolution.ts +++ b/src/testRunner/unittests/tscWatch/moduleResolution.ts @@ -376,6 +376,77 @@ describe("unittests:: tsc-watch:: moduleResolution", () => { ], }); + verifyTscWatch({ + scenario: "moduleResolution", + subScenario: "module resolutions from files with partially used import attributes", + sys: () => + createWatchedSystem([ + { + path: `/user/username/projects/myproject/tsconfig.json`, + content: JSON.stringify({ + compilerOptions: { moduleResolution: "node16" }, + }), + }, + { + path: `/user/username/projects/myproject/index.ts`, + content: Utils.dedent` + import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + import type { RequireInterface } from "pkg1" with { "resolution-mode": "require" }; + import {x} from "./a"; + `, + }, + { + path: `/user/username/projects/myproject/a.ts`, + content: Utils.dedent` + export const x = 10; + `, + }, + { + path: `/user/username/projects/myproject/node_modules/pkg/package.json`, + content: JSON.stringify({ + name: "pkg", + version: "0.0.1", + exports: { + import: "./import.js", + require: "./require.js", + }, + }), + }, + { + path: `/user/username/projects/myproject/node_modules/pkg/import.d.ts`, + content: `export interface ImportInterface {}`, + }, + { + path: `/user/username/projects/myproject/node_modules/pkg/require.d.ts`, + content: `export interface RequireInterface {}`, + }, + { + path: `/user/username/projects/myproject/node_modules/pkg1/package.json`, + content: JSON.stringify({ + name: "pkg1", + version: "0.0.1", + exports: { + import: "./import.js", + require: "./require.js", + }, + }), + }, + { + path: `/user/username/projects/myproject/node_modules/pkg1/import.d.ts`, + content: `export interface ImportInterface {}`, + }, + libFile, + ], { currentDirectory: "/user/username/projects/myproject" }), + commandLineArgs: ["-w", "--traceResolution"], + edits: [ + { + caption: "modify aFile by adding import", + edit: sys => sys.appendFile(`/user/username/projects/myproject/a.ts`, `import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }`), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ], + }); + verifyTscWatch({ scenario: "moduleResolution", subScenario: "type reference resolutions reuse", diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index dcea4be64289a..3ff54555f73b3 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4404,72 +4404,75 @@ declare namespace ts { DefaultClause = 297, HeritageClause = 298, CatchClause = 299, - AssertClause = 300, - AssertEntry = 301, - ImportTypeAssertionContainer = 302, - PropertyAssignment = 303, - ShorthandPropertyAssignment = 304, - SpreadAssignment = 305, - EnumMember = 306, - /** @deprecated */ UnparsedPrologue = 307, - /** @deprecated */ UnparsedPrepend = 308, - /** @deprecated */ UnparsedText = 309, - /** @deprecated */ UnparsedInternalText = 310, - /** @deprecated */ UnparsedSyntheticReference = 311, - SourceFile = 312, - Bundle = 313, - /** @deprecated */ UnparsedSource = 314, - /** @deprecated */ InputFiles = 315, - JSDocTypeExpression = 316, - JSDocNameReference = 317, - JSDocMemberName = 318, - JSDocAllType = 319, - JSDocUnknownType = 320, - JSDocNullableType = 321, - JSDocNonNullableType = 322, - JSDocOptionalType = 323, - JSDocFunctionType = 324, - JSDocVariadicType = 325, - JSDocNamepathType = 326, - JSDoc = 327, + /** @deprecated */ AssertClause = 300, + /** @deprecated */ AssertEntry = 301, + /** @deprecated */ ImportTypeAssertionContainer = 302, + ImportAttributes = 303, + ImportAttribute = 304, + ImportTypeAttributes = 305, + PropertyAssignment = 306, + ShorthandPropertyAssignment = 307, + SpreadAssignment = 308, + EnumMember = 309, + /** @deprecated */ UnparsedPrologue = 310, + /** @deprecated */ UnparsedPrepend = 311, + /** @deprecated */ UnparsedText = 312, + /** @deprecated */ UnparsedInternalText = 313, + /** @deprecated */ UnparsedSyntheticReference = 314, + SourceFile = 315, + Bundle = 316, + /** @deprecated */ UnparsedSource = 317, + /** @deprecated */ InputFiles = 318, + JSDocTypeExpression = 319, + JSDocNameReference = 320, + JSDocMemberName = 321, + JSDocAllType = 322, + JSDocUnknownType = 323, + JSDocNullableType = 324, + JSDocNonNullableType = 325, + JSDocOptionalType = 326, + JSDocFunctionType = 327, + JSDocVariadicType = 328, + JSDocNamepathType = 329, + JSDoc = 330, /** @deprecated Use SyntaxKind.JSDoc */ - JSDocComment = 327, - JSDocText = 328, - JSDocTypeLiteral = 329, - JSDocSignature = 330, - JSDocLink = 331, - JSDocLinkCode = 332, - JSDocLinkPlain = 333, - JSDocTag = 334, - JSDocAugmentsTag = 335, - JSDocImplementsTag = 336, - JSDocAuthorTag = 337, - JSDocDeprecatedTag = 338, - JSDocClassTag = 339, - JSDocPublicTag = 340, - JSDocPrivateTag = 341, - JSDocProtectedTag = 342, - JSDocReadonlyTag = 343, - JSDocOverrideTag = 344, - JSDocCallbackTag = 345, - JSDocOverloadTag = 346, - JSDocEnumTag = 347, - JSDocParameterTag = 348, - JSDocReturnTag = 349, - JSDocThisTag = 350, - JSDocTypeTag = 351, - JSDocTemplateTag = 352, - JSDocTypedefTag = 353, - JSDocSeeTag = 354, - JSDocPropertyTag = 355, - JSDocThrowsTag = 356, - JSDocSatisfiesTag = 357, - SyntaxList = 358, - NotEmittedStatement = 359, - PartiallyEmittedExpression = 360, - CommaListExpression = 361, - SyntheticReferenceExpression = 362, - Count = 363, + JSDocComment = 330, + JSDocText = 331, + JSDocTypeLiteral = 332, + JSDocSignature = 333, + JSDocLink = 334, + JSDocLinkCode = 335, + JSDocLinkPlain = 336, + JSDocTag = 337, + JSDocAugmentsTag = 338, + JSDocImplementsTag = 339, + JSDocAuthorTag = 340, + JSDocDeprecatedTag = 341, + JSDocClassTag = 342, + JSDocPublicTag = 343, + JSDocPrivateTag = 344, + JSDocProtectedTag = 345, + JSDocReadonlyTag = 346, + JSDocOverrideTag = 347, + JSDocCallbackTag = 348, + JSDocOverloadTag = 349, + JSDocEnumTag = 350, + JSDocParameterTag = 351, + JSDocReturnTag = 352, + JSDocThisTag = 353, + JSDocTypeTag = 354, + JSDocTemplateTag = 355, + JSDocTypedefTag = 356, + JSDocSeeTag = 357, + JSDocPropertyTag = 358, + JSDocThrowsTag = 359, + JSDocSatisfiesTag = 360, + SyntaxList = 361, + NotEmittedStatement = 362, + PartiallyEmittedExpression = 363, + CommaListExpression = 364, + SyntheticReferenceExpression = 365, + Count = 366, FirstAssignment = 64, LastAssignment = 79, FirstCompoundAssignment = 65, @@ -4497,10 +4500,10 @@ declare namespace ts { FirstStatement = 243, LastStatement = 259, FirstNode = 166, - FirstJSDocNode = 316, - LastJSDocNode = 357, - FirstJSDocTagNode = 334, - LastJSDocTagNode = 357, + FirstJSDocNode = 319, + LastJSDocNode = 360, + FirstJSDocTagNode = 337, + LastJSDocTagNode = 360, } type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; @@ -5137,17 +5140,25 @@ declare namespace ts { interface KeywordTypeNode extends KeywordToken, TypeNode { readonly kind: TKind; } + /** @deprecated */ interface ImportTypeAssertionContainer extends Node { readonly kind: SyntaxKind.ImportTypeAssertionContainer; readonly parent: ImportTypeNode; readonly assertClause: AssertClause; readonly multiLine?: boolean; } + interface ImportTypeAttributes extends Node { + readonly kind: SyntaxKind.ImportTypeAttributes; + readonly parent: ImportTypeNode; + readonly attributes: ImportAttributes; + readonly multiLine?: boolean; + } interface ImportTypeNode extends NodeWithTypeArguments { readonly kind: SyntaxKind.ImportType; readonly isTypeOf: boolean; readonly argument: TypeNode; - readonly assertions?: ImportTypeAssertionContainer; + /** @deprecated */ readonly assertions?: ImportTypeAssertionContainer; + readonly attributes?: ImportTypeAttributes; readonly qualifier?: EntityName; } interface ThisTypeNode extends TypeNode { @@ -5938,7 +5949,8 @@ declare namespace ts { readonly importClause?: ImportClause; /** If this is not a StringLiteral it will be a grammar error. */ readonly moduleSpecifier: Expression; - readonly assertClause?: AssertClause; + /** @deprecated */ readonly assertClause?: AssertClause; + readonly attributes?: ImportAttributes; } type NamedImportBindings = NamespaceImport | NamedImports; type NamedExportBindings = NamespaceExport | NamedExports; @@ -5949,19 +5961,35 @@ declare namespace ts { readonly name?: Identifier; readonly namedBindings?: NamedImportBindings; } + /** @deprecated */ type AssertionKey = Identifier | StringLiteral; + /** @deprecated */ interface AssertEntry extends Node { readonly kind: SyntaxKind.AssertEntry; readonly parent: AssertClause; readonly name: AssertionKey; readonly value: Expression; } + /** @deprecated */ interface AssertClause extends Node { readonly kind: SyntaxKind.AssertClause; readonly parent: ImportDeclaration | ExportDeclaration; readonly elements: NodeArray; readonly multiLine?: boolean; } + type ImportAttributeName = Identifier | StringLiteral | NumericLiteral; + interface ImportAttribute extends Node { + readonly kind: SyntaxKind.ImportAttribute; + readonly parent: ImportAttributes; + readonly name: ImportAttributeName; + readonly value: Expression; + } + interface ImportAttributes extends Node { + readonly kind: SyntaxKind.ImportAttributes; + readonly parent: ImportDeclaration | ExportDeclaration; + readonly elements: NodeArray; + readonly multiLine?: boolean; + } interface NamespaceImport extends NamedDeclaration { readonly kind: SyntaxKind.NamespaceImport; readonly parent: ImportClause; @@ -5985,7 +6013,8 @@ declare namespace ts { readonly exportClause?: NamedExportBindings; /** If this is not a StringLiteral it will be a grammar error. */ readonly moduleSpecifier?: Expression; - readonly assertClause?: AssertClause; + /** @deprecated */ readonly assertClause?: AssertClause; + readonly attributes?: ImportAttributes; } interface NamedImports extends Node { readonly kind: SyntaxKind.NamedImports; @@ -7946,8 +7975,8 @@ declare namespace ts { updateConditionalTypeNode(node: ConditionalTypeNode, checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode; createInferTypeNode(typeParameter: TypeParameterDeclaration): InferTypeNode; updateInferTypeNode(node: InferTypeNode, typeParameter: TypeParameterDeclaration): InferTypeNode; - createImportTypeNode(argument: TypeNode, assertions?: ImportTypeAssertionContainer, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; - updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, assertions: ImportTypeAssertionContainer | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode; + createImportTypeNode(argument: TypeNode, assertions?: ImportTypeAssertionContainer, attributes?: ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; + updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, assertions: ImportTypeAssertionContainer | undefined, attributes: ImportTypeAttributes | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode; createParenthesizedType(type: TypeNode): ParenthesizedTypeNode; updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode; createThisTypeNode(): ThisTypeNode; @@ -8104,16 +8133,22 @@ declare namespace ts { updateNamespaceExportDeclaration(node: NamespaceExportDeclaration, name: Identifier): NamespaceExportDeclaration; createImportEqualsDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; updateImportEqualsDeclaration(node: ImportEqualsDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; - createImportDeclaration(modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration; - updateImportDeclaration(node: ImportDeclaration, modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration; + createImportDeclaration(modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause, attributes?: ImportAttributes): ImportDeclaration; + updateImportDeclaration(node: ImportDeclaration, modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined, attributes: ImportAttributes | 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, multiLine?: boolean): AssertClause; - updateAssertClause(node: AssertClause, elements: NodeArray, multiLine?: boolean): AssertClause; - createAssertEntry(name: AssertionKey, value: Expression): AssertEntry; - updateAssertEntry(node: AssertEntry, name: AssertionKey, value: Expression): AssertEntry; - createImportTypeAssertionContainer(clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; - updateImportTypeAssertionContainer(node: ImportTypeAssertionContainer, clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; + /** @deprecated */ createAssertClause(elements: NodeArray, multiLine?: boolean): AssertClause; + /** @deprecated */ updateAssertClause(node: AssertClause, elements: NodeArray, multiLine?: boolean): AssertClause; + /** @deprecated */ createAssertEntry(name: AssertionKey, value: Expression): AssertEntry; + /** @deprecated */ updateAssertEntry(node: AssertEntry, name: AssertionKey, value: Expression): AssertEntry; + /** @deprecated */ createImportTypeAssertionContainer(clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; + /** @deprecated */ updateImportTypeAssertionContainer(node: ImportTypeAssertionContainer, clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; + createImportAttributes(elements: NodeArray, multiLine?: boolean): ImportAttributes; + updateImportAttributes(node: ImportAttributes, elements: NodeArray, multiLine?: boolean): ImportAttributes; + createImportAttribute(name: ImportAttributeName, value: Expression): ImportAttribute; + updateImportAttribute(node: ImportAttribute, name: ImportAttributeName, value: Expression): ImportAttribute; + createImportTypeAttributes(attributes: ImportAttributes, multiLine?: boolean): ImportTypeAttributes; + updateImportTypeAttributes(node: ImportTypeAttributes, attributes: ImportAttributes, multiLine?: boolean): ImportTypeAttributes; createNamespaceImport(name: Identifier): NamespaceImport; updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport; createNamespaceExport(name: Identifier): NamespaceExport; @@ -8124,8 +8159,8 @@ declare namespace ts { updateImportSpecifier(node: ImportSpecifier, isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; createExportAssignment(modifiers: readonly ModifierLike[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment; updateExportAssignment(node: ExportAssignment, modifiers: readonly ModifierLike[] | undefined, expression: Expression): ExportAssignment; - createExportDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration; - updateExportDeclaration(node: ExportDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration; + createExportDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause, attributes?: ImportAttributes): ExportDeclaration; + updateExportDeclaration(node: ExportDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined, attributes: ImportAttributes | undefined): ExportDeclaration; createNamedExports(elements: readonly ExportSpecifier[]): NamedExports; updateNamedExports(node: NamedExports, elements: readonly ExportSpecifier[]): NamedExports; createExportSpecifier(isTypeOnly: boolean, propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier; @@ -8574,7 +8609,8 @@ declare namespace ts { ObjectBindingPatternElements = 525136, ArrayBindingPatternElements = 524880, ObjectLiteralExpressionProperties = 526226, - ImportClauseEntries = 526226, + /** @deprecated */ ImportClauseEntries = 526226, + ImportAttributes = 526226, ArrayLiteralExpressionElements = 8914, CommaListElements = 528, CallExpressionArguments = 2576, @@ -9004,6 +9040,7 @@ declare namespace ts { function isTypeOnlyImportOrExportDeclaration(node: Node): node is TypeOnlyAliasDeclaration; function isAssertionKey(node: Node): node is AssertionKey; function isStringTextContainingNode(node: Node): node is StringLiteral | TemplateLiteralToken; + function isImportAttributeName(node: Node): node is ImportAttributeName; function isModifier(node: Node): node is Modifier; function isEntityName(node: Node): node is EntityName; function isPropertyName(node: Node): node is PropertyName; @@ -9086,6 +9123,8 @@ declare namespace ts { * ``` */ function getJSDocCommentsAndTags(hostNode: Node): readonly (JSDoc | JSDocTag)[]; + /** @intre */ + function hasResolutionModeOverride(node: ImportTypeNode | ImportDeclaration | ExportDeclaration | undefined): boolean; /** @deprecated */ function createUnparsedSourceFile(text: string): UnparsedSource; /** @deprecated */ @@ -9305,8 +9344,13 @@ declare namespace ts { function isImportDeclaration(node: Node): node is ImportDeclaration; function isImportClause(node: Node): node is ImportClause; function isImportTypeAssertionContainer(node: Node): node is ImportTypeAssertionContainer; + function isImportTypeAttributes(node: Node): node is ImportTypeAttributes; + /** @deprecated */ function isAssertClause(node: Node): node is AssertClause; + /** @deprecated */ function isAssertEntry(node: Node): node is AssertEntry; + function isImportAttributes(node: Node): node is ImportAttributes; + function isImportAttribute(node: Node): node is ImportAttribute; function isNamespaceImport(node: Node): node is NamespaceImport; function isNamespaceExport(node: Node): node is NamespaceExport; function isNamedImports(node: Node): node is NamedImports; diff --git a/tests/baselines/reference/completionImportAttributes.baseline b/tests/baselines/reference/completionImportAttributes.baseline new file mode 100644 index 0000000000000..7594f95cfc836 --- /dev/null +++ b/tests/baselines/reference/completionImportAttributes.baseline @@ -0,0 +1,272 @@ +=== /tests/cases/fourslash/main.ts === +// import("./other.json", {}); +// ^ +// | ---------------------------------------------------------------------- +// | (property) ImportCallOptions.with?: ImportAttributes +// | (property) ImportCallOptions.assert?: ImportAssertions +// | ---------------------------------------------------------------------- +// import("./other.json", { wi}); +// ^^ +// | ---------------------------------------------------------------------- +// | (property) ImportCallOptions.with?: ImportAttributes +// | (property) ImportCallOptions.assert?: ImportAssertions +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/main.ts", + "position": 24, + "name": "0" + }, + "item": { + "flags": 0, + "isGlobalCompletion": false, + "isMemberCompletion": true, + "isNewIdentifierLocation": false, + "entries": [ + { + "name": "with", + "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": "with", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ImportAttributes", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "assert", + "kind": "property", + "kindModifiers": "deprecated,declare,optional", + "sortText": "z12", + "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": [], + "tags": [ + { + "name": "deprecated" + } + ] + } + ] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/main.ts", + "position": 55, + "name": "1" + }, + "item": { + "flags": 0, + "isGlobalCompletion": false, + "isMemberCompletion": true, + "isNewIdentifierLocation": false, + "optionalReplacementSpan": { + "start": 53, + "length": 2 + }, + "entries": [ + { + "name": "with", + "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": "with", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ImportAttributes", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "assert", + "kind": "property", + "kindModifiers": "deprecated,declare,optional", + "sortText": "z12", + "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": [], + "tags": [ + { + "name": "deprecated" + } + ] + } + ] + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/completionImportCallAssertion.baseline b/tests/baselines/reference/completionImportCallAssertion.baseline index a4c3b58bd0ebc..605d0485a0813 100644 --- a/tests/baselines/reference/completionImportCallAssertion.baseline +++ b/tests/baselines/reference/completionImportCallAssertion.baseline @@ -2,11 +2,13 @@ // import("./other.json", {}); // ^ // | ---------------------------------------------------------------------- +// | (property) ImportCallOptions.with?: ImportAttributes // | (property) ImportCallOptions.assert?: ImportAssertions // | ---------------------------------------------------------------------- // import("./other.json", { asse}); // ^^^^ // | ---------------------------------------------------------------------- +// | (property) ImportCallOptions.with?: ImportAttributes // | (property) ImportCallOptions.assert?: ImportAssertions // | ---------------------------------------------------------------------- @@ -24,10 +26,63 @@ "isNewIdentifierLocation": false, "entries": [ { - "name": "assert", + "name": "with", "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": "with", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ImportAttributes", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "assert", + "kind": "property", + "kindModifiers": "deprecated,declare,optional", + "sortText": "z12", "displayParts": [ { "text": "(", @@ -74,7 +129,12 @@ "kind": "interfaceName" } ], - "documentation": [] + "documentation": [], + "tags": [ + { + "name": "deprecated" + } + ] } ] } @@ -96,10 +156,63 @@ }, "entries": [ { - "name": "assert", + "name": "with", "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": "with", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ImportAttributes", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "assert", + "kind": "property", + "kindModifiers": "deprecated,declare,optional", + "sortText": "z12", "displayParts": [ { "text": "(", @@ -146,7 +259,12 @@ "kind": "interfaceName" } ], - "documentation": [] + "documentation": [], + "tags": [ + { + "name": "deprecated" + } + ] } ] } diff --git a/tests/baselines/reference/completionsImportWithKeyword.baseline b/tests/baselines/reference/completionsImportWithKeyword.baseline new file mode 100644 index 0000000000000..6c516ae03b07b --- /dev/null +++ b/tests/baselines/reference/completionsImportWithKeyword.baseline @@ -0,0 +1,25192 @@ +=== /tests/cases/fourslash/a.ts === +// const f = { +// a: 1 +// }; +// import * as thing from "thing" +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | a: number; +// | } +// | import that +// | import thing +// | import those +// | abstract +// | any +// | interface Array +// | var Array: ArrayConstructor +// | interface ArrayBuffer +// | var ArrayBuffer: ArrayBufferConstructor +// | as +// | assert +// | asserts +// | async +// | await +// | bigint +// | boolean +// | interface Boolean +// | var Boolean: BooleanConstructor +// | break +// | case +// | catch +// | class +// | const +// | continue +// | interface DataView +// | var DataView: DataViewConstructor +// | interface Date +// | var Date: DateConstructor +// | debugger +// | declare +// | function decodeURI(encodedURI: string): string +// | function decodeURIComponent(encodedURIComponent: string): string +// | default +// | delete +// | do +// | else +// | function encodeURI(uri: string): string +// | function encodeURIComponent(uriComponent: string | number | boolean): string +// | enum +// | interface Error +// | var Error: ErrorConstructor +// | function eval(x: string): any +// | interface EvalError +// | var EvalError: EvalErrorConstructor +// | export +// | extends +// | false +// | finally +// | interface Float32Array +// | var Float32Array: Float32ArrayConstructor +// | interface Float64Array +// | var Float64Array: Float64ArrayConstructor +// | for +// | function +// | interface Function +// | var Function: FunctionConstructor +// | module globalThis +// | if +// | implements +// | import +// | in +// | infer +// | var Infinity: number +// | instanceof +// | interface Int16Array +// | var Int16Array: Int16ArrayConstructor +// | interface Int32Array +// | var Int32Array: Int32ArrayConstructor +// | interface Int8Array +// | var Int8Array: Int8ArrayConstructor +// | interface +// | namespace Intl +// | function isFinite(number: number): boolean +// | function isNaN(number: number): boolean +// | interface JSON +// | var JSON: JSON +// | keyof +// | let +// | interface Math +// | var Math: Math +// | module +// | namespace +// | var NaN: number +// | never +// | new +// | null +// | number +// | interface Number +// | var Number: NumberConstructor +// | object +// | interface Object +// | var Object: ObjectConstructor +// | package +// | function parseFloat(string: string): number +// | function parseInt(string: string, radix?: number): number +// | interface RangeError +// | var RangeError: RangeErrorConstructor +// | readonly +// | interface ReferenceError +// | var ReferenceError: ReferenceErrorConstructor +// | interface RegExp +// | var RegExp: RegExpConstructor +// | return +// | satisfies +// | string +// | interface String +// | var String: StringConstructor +// | super +// | switch +// | symbol +// | interface SyntaxError +// | var SyntaxError: SyntaxErrorConstructor +// | this +// | throw +// | true +// | try +// | type +// | interface TypeError +// | var TypeError: TypeErrorConstructor +// | typeof +// | interface Uint16Array +// | var Uint16Array: Uint16ArrayConstructor +// | interface Uint32Array +// | var Uint32Array: Uint32ArrayConstructor +// | interface Uint8Array +// | var Uint8Array: Uint8ArrayConstructor +// | interface Uint8ClampedArray +// | var Uint8ClampedArray: Uint8ClampedArrayConstructor +// | var undefined +// | unique +// | unknown +// | interface URIError +// | var URIError: URIErrorConstructor +// | var +// | void +// | while +// | with +// | yield +// | function escape(string: string): string +// | function unescape(string: string): string +// | ---------------------------------------------------------------------- +// export { foo } from "foo" +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | a: number; +// | } +// | import that +// | import thing +// | import those +// | abstract +// | any +// | interface Array +// | var Array: ArrayConstructor +// | interface ArrayBuffer +// | var ArrayBuffer: ArrayBufferConstructor +// | as +// | assert +// | asserts +// | async +// | await +// | bigint +// | boolean +// | interface Boolean +// | var Boolean: BooleanConstructor +// | break +// | case +// | catch +// | class +// | const +// | continue +// | interface DataView +// | var DataView: DataViewConstructor +// | interface Date +// | var Date: DateConstructor +// | debugger +// | declare +// | function decodeURI(encodedURI: string): string +// | function decodeURIComponent(encodedURIComponent: string): string +// | default +// | delete +// | do +// | else +// | function encodeURI(uri: string): string +// | function encodeURIComponent(uriComponent: string | number | boolean): string +// | enum +// | interface Error +// | var Error: ErrorConstructor +// | function eval(x: string): any +// | interface EvalError +// | var EvalError: EvalErrorConstructor +// | export +// | extends +// | false +// | finally +// | interface Float32Array +// | var Float32Array: Float32ArrayConstructor +// | interface Float64Array +// | var Float64Array: Float64ArrayConstructor +// | for +// | function +// | interface Function +// | var Function: FunctionConstructor +// | module globalThis +// | if +// | implements +// | import +// | in +// | infer +// | var Infinity: number +// | instanceof +// | interface Int16Array +// | var Int16Array: Int16ArrayConstructor +// | interface Int32Array +// | var Int32Array: Int32ArrayConstructor +// | interface Int8Array +// | var Int8Array: Int8ArrayConstructor +// | interface +// | namespace Intl +// | function isFinite(number: number): boolean +// | function isNaN(number: number): boolean +// | interface JSON +// | var JSON: JSON +// | keyof +// | let +// | interface Math +// | var Math: Math +// | module +// | namespace +// | var NaN: number +// | never +// | new +// | null +// | number +// | interface Number +// | var Number: NumberConstructor +// | object +// | interface Object +// | var Object: ObjectConstructor +// | package +// | function parseFloat(string: string): number +// | function parseInt(string: string, radix?: number): number +// | interface RangeError +// | var RangeError: RangeErrorConstructor +// | readonly +// | interface ReferenceError +// | var ReferenceError: ReferenceErrorConstructor +// | interface RegExp +// | var RegExp: RegExpConstructor +// | return +// | satisfies +// | string +// | interface String +// | var String: StringConstructor +// | super +// | switch +// | symbol +// | interface SyntaxError +// | var SyntaxError: SyntaxErrorConstructor +// | this +// | throw +// | true +// | try +// | type +// | interface TypeError +// | var TypeError: TypeErrorConstructor +// | typeof +// | interface Uint16Array +// | var Uint16Array: Uint16ArrayConstructor +// | interface Uint32Array +// | var Uint32Array: Uint32ArrayConstructor +// | interface Uint8Array +// | var Uint8Array: Uint8ArrayConstructor +// | interface Uint8ClampedArray +// | var Uint8ClampedArray: Uint8ClampedArrayConstructor +// | var undefined +// | unique +// | unknown +// | interface URIError +// | var URIError: URIErrorConstructor +// | var +// | void +// | while +// | with +// | yield +// | function escape(string: string): string +// | function unescape(string: string): string +// | ---------------------------------------------------------------------- +// import "foo" as +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | a: number; +// | } +// | import that +// | import thing +// | import those +// | abstract +// | any +// | interface Array +// | var Array: ArrayConstructor +// | interface ArrayBuffer +// | var ArrayBuffer: ArrayBufferConstructor +// | as +// | asserts +// | async +// | await +// | bigint +// | boolean +// | interface Boolean +// | var Boolean: BooleanConstructor +// | break +// | case +// | catch +// | class +// | const +// | continue +// | interface DataView +// | var DataView: DataViewConstructor +// | interface Date +// | var Date: DateConstructor +// | debugger +// | declare +// | function decodeURI(encodedURI: string): string +// | function decodeURIComponent(encodedURIComponent: string): string +// | default +// | delete +// | do +// | else +// | function encodeURI(uri: string): string +// | function encodeURIComponent(uriComponent: string | number | boolean): string +// | enum +// | interface Error +// | var Error: ErrorConstructor +// | function eval(x: string): any +// | interface EvalError +// | var EvalError: EvalErrorConstructor +// | export +// | extends +// | false +// | finally +// | interface Float32Array +// | var Float32Array: Float32ArrayConstructor +// | interface Float64Array +// | var Float64Array: Float64ArrayConstructor +// | for +// | function +// | interface Function +// | var Function: FunctionConstructor +// | module globalThis +// | if +// | implements +// | import +// | in +// | infer +// | var Infinity: number +// | instanceof +// | interface Int16Array +// | var Int16Array: Int16ArrayConstructor +// | interface Int32Array +// | var Int32Array: Int32ArrayConstructor +// | interface Int8Array +// | var Int8Array: Int8ArrayConstructor +// | interface +// | namespace Intl +// | function isFinite(number: number): boolean +// | function isNaN(number: number): boolean +// | interface JSON +// | var JSON: JSON +// | keyof +// | let +// | interface Math +// | var Math: Math +// | module +// | namespace +// | var NaN: number +// | never +// | new +// | null +// | number +// | interface Number +// | var Number: NumberConstructor +// | object +// | interface Object +// | var Object: ObjectConstructor +// | package +// | function parseFloat(string: string): number +// | function parseInt(string: string, radix?: number): number +// | interface RangeError +// | var RangeError: RangeErrorConstructor +// | readonly +// | interface ReferenceError +// | var ReferenceError: ReferenceErrorConstructor +// | interface RegExp +// | var RegExp: RegExpConstructor +// | return +// | satisfies +// | string +// | interface String +// | var String: StringConstructor +// | super +// | switch +// | symbol +// | interface SyntaxError +// | var SyntaxError: SyntaxErrorConstructor +// | this +// | throw +// | true +// | try +// | type +// | interface TypeError +// | var TypeError: TypeErrorConstructor +// | typeof +// | interface Uint16Array +// | var Uint16Array: Uint16ArrayConstructor +// | interface Uint32Array +// | var Uint32Array: Uint32ArrayConstructor +// | interface Uint8Array +// | var Uint8Array: Uint8ArrayConstructor +// | interface Uint8ClampedArray +// | var Uint8ClampedArray: Uint8ClampedArrayConstructor +// | var undefined +// | unique +// | unknown +// | interface URIError +// | var URIError: URIErrorConstructor +// | var +// | void +// | while +// | with +// | yield +// | function escape(string: string): string +// | function unescape(string: string): string +// | ---------------------------------------------------------------------- +// import "foo" w +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | a: number; +// | } +// | import that +// | import thing +// | import those +// | abstract +// | any +// | interface Array +// | var Array: ArrayConstructor +// | interface ArrayBuffer +// | var ArrayBuffer: ArrayBufferConstructor +// | as +// | assert +// | asserts +// | async +// | await +// | bigint +// | boolean +// | interface Boolean +// | var Boolean: BooleanConstructor +// | break +// | case +// | catch +// | class +// | const +// | continue +// | interface DataView +// | var DataView: DataViewConstructor +// | interface Date +// | var Date: DateConstructor +// | debugger +// | declare +// | function decodeURI(encodedURI: string): string +// | function decodeURIComponent(encodedURIComponent: string): string +// | default +// | delete +// | do +// | else +// | function encodeURI(uri: string): string +// | function encodeURIComponent(uriComponent: string | number | boolean): string +// | enum +// | interface Error +// | var Error: ErrorConstructor +// | function eval(x: string): any +// | interface EvalError +// | var EvalError: EvalErrorConstructor +// | export +// | extends +// | false +// | finally +// | interface Float32Array +// | var Float32Array: Float32ArrayConstructor +// | interface Float64Array +// | var Float64Array: Float64ArrayConstructor +// | for +// | function +// | interface Function +// | var Function: FunctionConstructor +// | module globalThis +// | if +// | implements +// | import +// | in +// | infer +// | var Infinity: number +// | instanceof +// | interface Int16Array +// | var Int16Array: Int16ArrayConstructor +// | interface Int32Array +// | var Int32Array: Int32ArrayConstructor +// | interface Int8Array +// | var Int8Array: Int8ArrayConstructor +// | interface +// | namespace Intl +// | function isFinite(number: number): boolean +// | function isNaN(number: number): boolean +// | interface JSON +// | var JSON: JSON +// | keyof +// | let +// | interface Math +// | var Math: Math +// | module +// | namespace +// | var NaN: number +// | never +// | new +// | null +// | number +// | interface Number +// | var Number: NumberConstructor +// | object +// | interface Object +// | var Object: ObjectConstructor +// | package +// | function parseFloat(string: string): number +// | function parseInt(string: string, radix?: number): number +// | interface RangeError +// | var RangeError: RangeErrorConstructor +// | readonly +// | interface ReferenceError +// | var ReferenceError: ReferenceErrorConstructor +// | interface RegExp +// | var RegExp: RegExpConstructor +// | return +// | satisfies +// | string +// | interface String +// | var String: StringConstructor +// | super +// | switch +// | symbol +// | interface SyntaxError +// | var SyntaxError: SyntaxErrorConstructor +// | this +// | throw +// | true +// | try +// | type +// | interface TypeError +// | var TypeError: TypeErrorConstructor +// | typeof +// | interface Uint16Array +// | var Uint16Array: Uint16ArrayConstructor +// | interface Uint32Array +// | var Uint32Array: Uint32ArrayConstructor +// | interface Uint8Array +// | var Uint8Array: Uint8ArrayConstructor +// | interface Uint8ClampedArray +// | var Uint8ClampedArray: Uint8ClampedArrayConstructor +// | var undefined +// | unique +// | unknown +// | interface URIError +// | var URIError: URIErrorConstructor +// | var +// | void +// | while +// | with +// | yield +// | function escape(string: string): string +// | function unescape(string: string): string +// | ---------------------------------------------------------------------- +// import * as that from "that" +// +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | a: number; +// | } +// | import that +// | import thing +// | import those +// | abstract +// | any +// | interface Array +// | var Array: ArrayConstructor +// | interface ArrayBuffer +// | var ArrayBuffer: ArrayBufferConstructor +// | as +// | asserts +// | async +// | await +// | bigint +// | boolean +// | interface Boolean +// | var Boolean: BooleanConstructor +// | break +// | case +// | catch +// | class +// | const +// | continue +// | interface DataView +// | var DataView: DataViewConstructor +// | interface Date +// | var Date: DateConstructor +// | debugger +// | declare +// | function decodeURI(encodedURI: string): string +// | function decodeURIComponent(encodedURIComponent: string): string +// | default +// | delete +// | do +// | else +// | function encodeURI(uri: string): string +// | function encodeURIComponent(uriComponent: string | number | boolean): string +// | enum +// | interface Error +// | var Error: ErrorConstructor +// | function eval(x: string): any +// | interface EvalError +// | var EvalError: EvalErrorConstructor +// | export +// | extends +// | false +// | finally +// | interface Float32Array +// | var Float32Array: Float32ArrayConstructor +// | interface Float64Array +// | var Float64Array: Float64ArrayConstructor +// | for +// | function +// | interface Function +// | var Function: FunctionConstructor +// | module globalThis +// | if +// | implements +// | import +// | in +// | infer +// | var Infinity: number +// | instanceof +// | interface Int16Array +// | var Int16Array: Int16ArrayConstructor +// | interface Int32Array +// | var Int32Array: Int32ArrayConstructor +// | interface Int8Array +// | var Int8Array: Int8ArrayConstructor +// | interface +// | namespace Intl +// | function isFinite(number: number): boolean +// | function isNaN(number: number): boolean +// | interface JSON +// | var JSON: JSON +// | keyof +// | let +// | interface Math +// | var Math: Math +// | module +// | namespace +// | var NaN: number +// | never +// | new +// | null +// | number +// | interface Number +// | var Number: NumberConstructor +// | object +// | interface Object +// | var Object: ObjectConstructor +// | package +// | function parseFloat(string: string): number +// | function parseInt(string: string, radix?: number): number +// | interface RangeError +// | var RangeError: RangeErrorConstructor +// | readonly +// | interface ReferenceError +// | var ReferenceError: ReferenceErrorConstructor +// | interface RegExp +// | var RegExp: RegExpConstructor +// | return +// | satisfies +// | string +// | interface String +// | var String: StringConstructor +// | super +// | switch +// | symbol +// | interface SyntaxError +// | var SyntaxError: SyntaxErrorConstructor +// | this +// | throw +// | true +// | try +// | type +// | interface TypeError +// | var TypeError: TypeErrorConstructor +// | typeof +// | interface Uint16Array +// | var Uint16Array: Uint16ArrayConstructor +// | interface Uint32Array +// | var Uint32Array: Uint32ArrayConstructor +// | interface Uint8Array +// | var Uint8Array: Uint8ArrayConstructor +// | interface Uint8ClampedArray +// | var Uint8ClampedArray: Uint8ClampedArrayConstructor +// | var undefined +// | unique +// | unknown +// | interface URIError +// | var URIError: URIErrorConstructor +// | var +// | void +// | while +// | with +// | yield +// | function escape(string: string): string +// | function unescape(string: string): string +// | ---------------------------------------------------------------------- +// import * as those from "those" +// ^ +// | ---------------------------------------------------------------------- +// | const f: { +// | a: number; +// | } +// | import that +// | import thing +// | import those +// | abstract +// | any +// | interface Array +// | var Array: ArrayConstructor +// | interface ArrayBuffer +// | var ArrayBuffer: ArrayBufferConstructor +// | as +// | asserts +// | async +// | await +// | bigint +// | boolean +// | interface Boolean +// | var Boolean: BooleanConstructor +// | break +// | case +// | catch +// | class +// | const +// | continue +// | interface DataView +// | var DataView: DataViewConstructor +// | interface Date +// | var Date: DateConstructor +// | debugger +// | declare +// | function decodeURI(encodedURI: string): string +// | function decodeURIComponent(encodedURIComponent: string): string +// | default +// | delete +// | do +// | else +// | function encodeURI(uri: string): string +// | function encodeURIComponent(uriComponent: string | number | boolean): string +// | enum +// | interface Error +// | var Error: ErrorConstructor +// | function eval(x: string): any +// | interface EvalError +// | var EvalError: EvalErrorConstructor +// | export +// | extends +// | false +// | finally +// | interface Float32Array +// | var Float32Array: Float32ArrayConstructor +// | interface Float64Array +// | var Float64Array: Float64ArrayConstructor +// | for +// | function +// | interface Function +// | var Function: FunctionConstructor +// | module globalThis +// | if +// | implements +// | import +// | in +// | infer +// | var Infinity: number +// | instanceof +// | interface Int16Array +// | var Int16Array: Int16ArrayConstructor +// | interface Int32Array +// | var Int32Array: Int32ArrayConstructor +// | interface Int8Array +// | var Int8Array: Int8ArrayConstructor +// | interface +// | namespace Intl +// | function isFinite(number: number): boolean +// | function isNaN(number: number): boolean +// | interface JSON +// | var JSON: JSON +// | keyof +// | let +// | interface Math +// | var Math: Math +// | module +// | namespace +// | var NaN: number +// | never +// | new +// | null +// | number +// | interface Number +// | var Number: NumberConstructor +// | object +// | interface Object +// | var Object: ObjectConstructor +// | package +// | function parseFloat(string: string): number +// | function parseInt(string: string, radix?: number): number +// | interface RangeError +// | var RangeError: RangeErrorConstructor +// | readonly +// | interface ReferenceError +// | var ReferenceError: ReferenceErrorConstructor +// | interface RegExp +// | var RegExp: RegExpConstructor +// | return +// | satisfies +// | string +// | interface String +// | var String: StringConstructor +// | super +// | switch +// | symbol +// | interface SyntaxError +// | var SyntaxError: SyntaxErrorConstructor +// | this +// | throw +// | true +// | try +// | type +// | interface TypeError +// | var TypeError: TypeErrorConstructor +// | typeof +// | interface Uint16Array +// | var Uint16Array: Uint16ArrayConstructor +// | interface Uint32Array +// | var Uint32Array: Uint32ArrayConstructor +// | interface Uint8Array +// | var Uint8Array: Uint8ArrayConstructor +// | interface Uint8ClampedArray +// | var Uint8ClampedArray: Uint8ClampedArrayConstructor +// | var undefined +// | unique +// | unknown +// | interface URIError +// | var URIError: URIErrorConstructor +// | var +// | void +// | while +// | with +// | yield +// | function escape(string: string): string +// | function unescape(string: string): string +// | ---------------------------------------------------------------------- + +=== /tests/cases/fourslash/b.js === +// import * as thing from "thing" ; +// ^ +// | ---------------------------------------------------------------------- +// | import thing +// | interface Array +// | var Array: ArrayConstructor +// | interface ArrayBuffer +// | var ArrayBuffer: ArrayBufferConstructor +// | as +// | assert +// | asserts +// | async +// | await +// | interface Boolean +// | var Boolean: BooleanConstructor +// | break +// | case +// | catch +// | class +// | const +// | continue +// | interface DataView +// | var DataView: DataViewConstructor +// | interface Date +// | var Date: DateConstructor +// | debugger +// | function decodeURI(encodedURI: string): string +// | function decodeURIComponent(encodedURIComponent: string): string +// | default +// | delete +// | do +// | else +// | function encodeURI(uri: string): string +// | function encodeURIComponent(uriComponent: string | number | boolean): string +// | interface Error +// | var Error: ErrorConstructor +// | function eval(x: string): any +// | interface EvalError +// | var EvalError: EvalErrorConstructor +// | export +// | extends +// | false +// | finally +// | interface Float32Array +// | var Float32Array: Float32ArrayConstructor +// | interface Float64Array +// | var Float64Array: Float64ArrayConstructor +// | for +// | function +// | interface Function +// | var Function: FunctionConstructor +// | module globalThis +// | if +// | import +// | in +// | var Infinity: number +// | instanceof +// | interface Int16Array +// | var Int16Array: Int16ArrayConstructor +// | interface Int32Array +// | var Int32Array: Int32ArrayConstructor +// | interface Int8Array +// | var Int8Array: Int8ArrayConstructor +// | namespace Intl +// | function isFinite(number: number): boolean +// | function isNaN(number: number): boolean +// | interface JSON +// | var JSON: JSON +// | let +// | interface Math +// | var Math: Math +// | var NaN: number +// | new +// | null +// | interface Number +// | var Number: NumberConstructor +// | interface Object +// | var Object: ObjectConstructor +// | package +// | function parseFloat(string: string): number +// | function parseInt(string: string, radix?: number): number +// | interface RangeError +// | var RangeError: RangeErrorConstructor +// | interface ReferenceError +// | var ReferenceError: ReferenceErrorConstructor +// | interface RegExp +// | var RegExp: RegExpConstructor +// | return +// | satisfies +// | interface String +// | var String: StringConstructor +// | super +// | switch +// | interface SyntaxError +// | var SyntaxError: SyntaxErrorConstructor +// | this +// | throw +// | true +// | try +// | interface TypeError +// | var TypeError: TypeErrorConstructor +// | typeof +// | interface Uint16Array +// | var Uint16Array: Uint16ArrayConstructor +// | interface Uint32Array +// | var Uint32Array: Uint32ArrayConstructor +// | interface Uint8Array +// | var Uint8Array: Uint8ArrayConstructor +// | interface Uint8ClampedArray +// | var Uint8ClampedArray: Uint8ClampedArrayConstructor +// | var undefined +// | interface URIError +// | var URIError: URIErrorConstructor +// | var +// | void +// | while +// | with +// | yield +// | function escape(string: string): string +// | function unescape(string: string): string +// | ---------------------------------------------------------------------- + +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 57, + "name": "0" + }, + "item": { + "flags": 0, + "isGlobalCompletion": true, + "isMemberCompletion": false, + "isNewIdentifierLocation": false, + "entries": [ + { + "name": "f", + "kind": "const", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [] + }, + { + "name": "that", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "that", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "thing", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "thing", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "those", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "those", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "abstract", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "abstract", + "kind": "keyword" + } + ] + }, + { + "name": "any", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "any", + "kind": "keyword" + } + ] + }, + { + "name": "Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "ArrayBuffer", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBuffer", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBuffer", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBufferConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Represents a raw buffer of binary data, which is used to store data for the\ndifferent typed arrays. ArrayBuffers cannot be read from or written to directly,\nbut can be passed to a typed array or DataView Object to interpret the raw\nbuffer as needed.", + "kind": "text" + } + ] + }, + { + "name": "as", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "as", + "kind": "keyword" + } + ] + }, + { + "name": "assert", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "assert", + "kind": "keyword" + } + ] + }, + { + "name": "asserts", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "asserts", + "kind": "keyword" + } + ] + }, + { + "name": "async", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "async", + "kind": "keyword" + } + ] + }, + { + "name": "await", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "await", + "kind": "keyword" + } + ] + }, + { + "name": "bigint", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "bigint", + "kind": "keyword" + } + ] + }, + { + "name": "boolean", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "boolean", + "kind": "keyword" + } + ] + }, + { + "name": "Boolean", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Boolean", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Boolean", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "BooleanConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "break", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "break", + "kind": "keyword" + } + ] + }, + { + "name": "case", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "case", + "kind": "keyword" + } + ] + }, + { + "name": "catch", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "catch", + "kind": "keyword" + } + ] + }, + { + "name": "class", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "class", + "kind": "keyword" + } + ] + }, + { + "name": "const", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "const", + "kind": "keyword" + } + ] + }, + { + "name": "continue", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "continue", + "kind": "keyword" + } + ] + }, + { + "name": "DataView", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataView", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataView", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataViewConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "Date", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DateConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Enables basic storage and retrieval of dates and times.", + "kind": "text" + } + ] + }, + { + "name": "debugger", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "debugger", + "kind": "keyword" + } + ] + }, + { + "name": "declare", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "declare", + "kind": "keyword" + } + ] + }, + { + "name": "decodeURI", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decodeURI", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "encodedURI", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Gets the unencoded version of an encoded Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "encodedURI", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "decodeURIComponent", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decodeURIComponent", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "encodedURIComponent", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "encodedURIComponent", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "default", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "default", + "kind": "keyword" + } + ] + }, + { + "name": "delete", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "delete", + "kind": "keyword" + } + ] + }, + { + "name": "do", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "do", + "kind": "keyword" + } + ] + }, + { + "name": "else", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "else", + "kind": "keyword" + } + ] + }, + { + "name": "encodeURI", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "encodeURI", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "uri", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Encodes a text string as a valid Uniform Resource Identifier (URI)", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "uri", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an unencoded URI.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "encodeURIComponent", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "encodeURIComponent", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "uriComponent", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Encodes a text string as a valid component of a Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "uriComponent", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an unencoded URI component.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "enum", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "enum", + "kind": "keyword" + } + ] + }, + { + "name": "Error", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Error", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Error", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "eval", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "eval", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Evaluates JavaScript code and executes it.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "x", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "EvalError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "export", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "export", + "kind": "keyword" + } + ] + }, + { + "name": "extends", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "extends", + "kind": "keyword" + } + ] + }, + { + "name": "false", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "false", + "kind": "keyword" + } + ] + }, + { + "name": "finally", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "finally", + "kind": "keyword" + } + ] + }, + { + "name": "Float32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\nof bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Float64Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 64-bit float values. The contents are initialized to 0. If the requested\nnumber of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "for", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "for", + "kind": "keyword" + } + ] + }, + { + "name": "function", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + } + ] + }, + { + "name": "Function", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Function", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Function", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FunctionConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Creates a new function.", + "kind": "text" + } + ] + }, + { + "name": "globalThis", + "kind": "module", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalThis", + "kind": "moduleName" + } + ], + "documentation": [] + }, + { + "name": "if", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "if", + "kind": "keyword" + } + ] + }, + { + "name": "implements", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "implements", + "kind": "keyword" + } + ] + }, + { + "name": "import", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + } + ] + }, + { + "name": "in", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "in", + "kind": "keyword" + } + ] + }, + { + "name": "infer", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "infer", + "kind": "keyword" + } + ] + }, + { + "name": "Infinity", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Infinity", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [] + }, + { + "name": "instanceof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "instanceof", + "kind": "keyword" + } + ] + }, + { + "name": "Int16Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 16-bit signed integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Int32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit signed integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Int8Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit integer values. The contents are initialized to 0. If the requested\nnumber of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "interface", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + } + ] + }, + { + "name": "Intl", + "kind": "module", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Intl", + "kind": "moduleName" + } + ], + "documentation": [] + }, + { + "name": "isFinite", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isFinite", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Determines whether a supplied number is finite.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "number", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "isNaN", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isNaN", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "number", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "JSON", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + } + ], + "documentation": [ + { + "text": "An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.", + "kind": "text" + } + ] + }, + { + "name": "keyof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "keyof", + "kind": "keyword" + } + ] + }, + { + "name": "let", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "let", + "kind": "keyword" + } + ] + }, + { + "name": "Math", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + } + ], + "documentation": [ + { + "text": "An intrinsic object that provides basic mathematics functionality and constants.", + "kind": "text" + } + ] + }, + { + "name": "module", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "module", + "kind": "keyword" + } + ] + }, + { + "name": "namespace", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + } + ] + }, + { + "name": "NaN", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NaN", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [] + }, + { + "name": "never", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "never", + "kind": "keyword" + } + ] + }, + { + "name": "new", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "new", + "kind": "keyword" + } + ] + }, + { + "name": "null", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "null", + "kind": "keyword" + } + ] + }, + { + "name": "number", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "number", + "kind": "keyword" + } + ] + }, + { + "name": "Number", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Number", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Number", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NumberConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers.", + "kind": "text" + } + ] + }, + { + "name": "object", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "object", + "kind": "keyword" + } + ] + }, + { + "name": "Object", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Object", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Object", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ObjectConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Provides functionality common to all JavaScript objects.", + "kind": "text" + } + ] + }, + { + "name": "package", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "package", + "kind": "keyword" + } + ] + }, + { + "name": "parseFloat", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "parseFloat", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Converts a string to a floating-point number.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "parseInt", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "parseInt", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "radix", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Converts a string to an integer.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "radix", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in `string`.\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\nAll other strings are considered decimal.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "RangeError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "readonly", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "readonly", + "kind": "keyword" + } + ] + }, + { + "name": "ReferenceError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "RegExp", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExp", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExp", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExpConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "return", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "return", + "kind": "keyword" + } + ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] + }, + { + "name": "string", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "string", + "kind": "keyword" + } + ] + }, + { + "name": "String", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "String", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "String", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "StringConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Allows manipulation and formatting of text strings and determination and location of substrings within strings.", + "kind": "text" + } + ] + }, + { + "name": "super", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "super", + "kind": "keyword" + } + ] + }, + { + "name": "switch", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "switch", + "kind": "keyword" + } + ] + }, + { + "name": "symbol", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "symbol", + "kind": "keyword" + } + ] + }, + { + "name": "SyntaxError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "this", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "this", + "kind": "keyword" + } + ] + }, + { + "name": "throw", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "throw", + "kind": "keyword" + } + ] + }, + { + "name": "true", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "true", + "kind": "keyword" + } + ] + }, + { + "name": "try", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "try", + "kind": "keyword" + } + ] + }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, + { + "name": "TypeError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "typeof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "typeof", + "kind": "keyword" + } + ] + }, + { + "name": "Uint16Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint8Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint8ClampedArray", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArray", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArray", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.\nIf the requested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "undefined", + "kind": "var", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "undefined", + "kind": "propertyName" + } + ], + "documentation": [] + }, + { + "name": "unique", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "unique", + "kind": "keyword" + } + ] + }, + { + "name": "unknown", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "unknown", + "kind": "keyword" + } + ] + }, + { + "name": "URIError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "var", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + } + ] + }, + { + "name": "void", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "void", + "kind": "keyword" + } + ] + }, + { + "name": "while", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "while", + "kind": "keyword" + } + ] + }, + { + "name": "with", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "with", + "kind": "keyword" + } + ] + }, + { + "name": "yield", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "yield", + "kind": "keyword" + } + ] + }, + { + "name": "escape", + "kind": "function", + "kindModifiers": "deprecated,declare", + "sortText": "z15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "escape", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.", + "kind": "text" + } + ], + "tags": [ + { + "name": "deprecated", + "text": [ + { + "text": "A legacy feature for browser compatibility", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] + } + ] + }, + { + "name": "unescape", + "kind": "function", + "kindModifiers": "deprecated,declare", + "sortText": "z15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "unescape", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Computes a new string in which hexadecimal escape sequences are replaced with the character that it represents.", + "kind": "text" + } + ], + "tags": [ + { + "name": "deprecated", + "text": [ + { + "text": "A legacy feature for browser compatibility", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] + } + ] + } + ] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 85, + "name": "1" + }, + "item": { + "flags": 0, + "isGlobalCompletion": true, + "isMemberCompletion": false, + "isNewIdentifierLocation": false, + "entries": [ + { + "name": "f", + "kind": "const", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [] + }, + { + "name": "that", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "that", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "thing", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "thing", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "those", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "those", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "abstract", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "abstract", + "kind": "keyword" + } + ] + }, + { + "name": "any", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "any", + "kind": "keyword" + } + ] + }, + { + "name": "Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "ArrayBuffer", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBuffer", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBuffer", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBufferConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Represents a raw buffer of binary data, which is used to store data for the\ndifferent typed arrays. ArrayBuffers cannot be read from or written to directly,\nbut can be passed to a typed array or DataView Object to interpret the raw\nbuffer as needed.", + "kind": "text" + } + ] + }, + { + "name": "as", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "as", + "kind": "keyword" + } + ] + }, + { + "name": "assert", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "assert", + "kind": "keyword" + } + ] + }, + { + "name": "asserts", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "asserts", + "kind": "keyword" + } + ] + }, + { + "name": "async", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "async", + "kind": "keyword" + } + ] + }, + { + "name": "await", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "await", + "kind": "keyword" + } + ] + }, + { + "name": "bigint", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "bigint", + "kind": "keyword" + } + ] + }, + { + "name": "boolean", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "boolean", + "kind": "keyword" + } + ] + }, + { + "name": "Boolean", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Boolean", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Boolean", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "BooleanConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "break", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "break", + "kind": "keyword" + } + ] + }, + { + "name": "case", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "case", + "kind": "keyword" + } + ] + }, + { + "name": "catch", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "catch", + "kind": "keyword" + } + ] + }, + { + "name": "class", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "class", + "kind": "keyword" + } + ] + }, + { + "name": "const", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "const", + "kind": "keyword" + } + ] + }, + { + "name": "continue", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "continue", + "kind": "keyword" + } + ] + }, + { + "name": "DataView", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataView", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataView", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataViewConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "Date", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DateConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Enables basic storage and retrieval of dates and times.", + "kind": "text" + } + ] + }, + { + "name": "debugger", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "debugger", + "kind": "keyword" + } + ] + }, + { + "name": "declare", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "declare", + "kind": "keyword" + } + ] + }, + { + "name": "decodeURI", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decodeURI", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "encodedURI", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Gets the unencoded version of an encoded Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "encodedURI", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "decodeURIComponent", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decodeURIComponent", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "encodedURIComponent", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "encodedURIComponent", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "default", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "default", + "kind": "keyword" + } + ] + }, + { + "name": "delete", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "delete", + "kind": "keyword" + } + ] + }, + { + "name": "do", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "do", + "kind": "keyword" + } + ] + }, + { + "name": "else", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "else", + "kind": "keyword" + } + ] + }, + { + "name": "encodeURI", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "encodeURI", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "uri", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Encodes a text string as a valid Uniform Resource Identifier (URI)", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "uri", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an unencoded URI.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "encodeURIComponent", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "encodeURIComponent", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "uriComponent", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Encodes a text string as a valid component of a Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "uriComponent", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an unencoded URI component.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "enum", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "enum", + "kind": "keyword" + } + ] + }, + { + "name": "Error", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Error", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Error", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "eval", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "eval", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Evaluates JavaScript code and executes it.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "x", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "EvalError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "export", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "export", + "kind": "keyword" + } + ] + }, + { + "name": "extends", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "extends", + "kind": "keyword" + } + ] + }, + { + "name": "false", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "false", + "kind": "keyword" + } + ] + }, + { + "name": "finally", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "finally", + "kind": "keyword" + } + ] + }, + { + "name": "Float32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\nof bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Float64Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 64-bit float values. The contents are initialized to 0. If the requested\nnumber of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "for", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "for", + "kind": "keyword" + } + ] + }, + { + "name": "function", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + } + ] + }, + { + "name": "Function", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Function", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Function", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FunctionConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Creates a new function.", + "kind": "text" + } + ] + }, + { + "name": "globalThis", + "kind": "module", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalThis", + "kind": "moduleName" + } + ], + "documentation": [] + }, + { + "name": "if", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "if", + "kind": "keyword" + } + ] + }, + { + "name": "implements", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "implements", + "kind": "keyword" + } + ] + }, + { + "name": "import", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + } + ] + }, + { + "name": "in", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "in", + "kind": "keyword" + } + ] + }, + { + "name": "infer", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "infer", + "kind": "keyword" + } + ] + }, + { + "name": "Infinity", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Infinity", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [] + }, + { + "name": "instanceof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "instanceof", + "kind": "keyword" + } + ] + }, + { + "name": "Int16Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 16-bit signed integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Int32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit signed integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Int8Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit integer values. The contents are initialized to 0. If the requested\nnumber of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "interface", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + } + ] + }, + { + "name": "Intl", + "kind": "module", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Intl", + "kind": "moduleName" + } + ], + "documentation": [] + }, + { + "name": "isFinite", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isFinite", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Determines whether a supplied number is finite.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "number", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "isNaN", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isNaN", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "number", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "JSON", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + } + ], + "documentation": [ + { + "text": "An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.", + "kind": "text" + } + ] + }, + { + "name": "keyof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "keyof", + "kind": "keyword" + } + ] + }, + { + "name": "let", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "let", + "kind": "keyword" + } + ] + }, + { + "name": "Math", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + } + ], + "documentation": [ + { + "text": "An intrinsic object that provides basic mathematics functionality and constants.", + "kind": "text" + } + ] + }, + { + "name": "module", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "module", + "kind": "keyword" + } + ] + }, + { + "name": "namespace", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + } + ] + }, + { + "name": "NaN", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NaN", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [] + }, + { + "name": "never", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "never", + "kind": "keyword" + } + ] + }, + { + "name": "new", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "new", + "kind": "keyword" + } + ] + }, + { + "name": "null", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "null", + "kind": "keyword" + } + ] + }, + { + "name": "number", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "number", + "kind": "keyword" + } + ] + }, + { + "name": "Number", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Number", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Number", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NumberConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers.", + "kind": "text" + } + ] + }, + { + "name": "object", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "object", + "kind": "keyword" + } + ] + }, + { + "name": "Object", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Object", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Object", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ObjectConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Provides functionality common to all JavaScript objects.", + "kind": "text" + } + ] + }, + { + "name": "package", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "package", + "kind": "keyword" + } + ] + }, + { + "name": "parseFloat", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "parseFloat", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Converts a string to a floating-point number.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "parseInt", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "parseInt", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "radix", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Converts a string to an integer.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "radix", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in `string`.\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\nAll other strings are considered decimal.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "RangeError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "readonly", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "readonly", + "kind": "keyword" + } + ] + }, + { + "name": "ReferenceError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "RegExp", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExp", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExp", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExpConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "return", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "return", + "kind": "keyword" + } + ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] + }, + { + "name": "string", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "string", + "kind": "keyword" + } + ] + }, + { + "name": "String", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "String", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "String", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "StringConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Allows manipulation and formatting of text strings and determination and location of substrings within strings.", + "kind": "text" + } + ] + }, + { + "name": "super", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "super", + "kind": "keyword" + } + ] + }, + { + "name": "switch", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "switch", + "kind": "keyword" + } + ] + }, + { + "name": "symbol", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "symbol", + "kind": "keyword" + } + ] + }, + { + "name": "SyntaxError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "this", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "this", + "kind": "keyword" + } + ] + }, + { + "name": "throw", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "throw", + "kind": "keyword" + } + ] + }, + { + "name": "true", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "true", + "kind": "keyword" + } + ] + }, + { + "name": "try", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "try", + "kind": "keyword" + } + ] + }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, + { + "name": "TypeError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "typeof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "typeof", + "kind": "keyword" + } + ] + }, + { + "name": "Uint16Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint8Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint8ClampedArray", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArray", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArray", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.\nIf the requested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "undefined", + "kind": "var", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "undefined", + "kind": "propertyName" + } + ], + "documentation": [] + }, + { + "name": "unique", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "unique", + "kind": "keyword" + } + ] + }, + { + "name": "unknown", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "unknown", + "kind": "keyword" + } + ] + }, + { + "name": "URIError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "var", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + } + ] + }, + { + "name": "void", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "void", + "kind": "keyword" + } + ] + }, + { + "name": "while", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "while", + "kind": "keyword" + } + ] + }, + { + "name": "with", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "with", + "kind": "keyword" + } + ] + }, + { + "name": "yield", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "yield", + "kind": "keyword" + } + ] + }, + { + "name": "escape", + "kind": "function", + "kindModifiers": "deprecated,declare", + "sortText": "z15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "escape", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.", + "kind": "text" + } + ], + "tags": [ + { + "name": "deprecated", + "text": [ + { + "text": "A legacy feature for browser compatibility", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] + } + ] + }, + { + "name": "unescape", + "kind": "function", + "kindModifiers": "deprecated,declare", + "sortText": "z15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "unescape", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Computes a new string in which hexadecimal escape sequences are replaced with the character that it represents.", + "kind": "text" + } + ], + "tags": [ + { + "name": "deprecated", + "text": [ + { + "text": "A legacy feature for browser compatibility", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] + } + ] + } + ] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 103, + "name": "2" + }, + "item": { + "flags": 0, + "isGlobalCompletion": true, + "isMemberCompletion": false, + "isNewIdentifierLocation": false, + "entries": [ + { + "name": "f", + "kind": "const", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [] + }, + { + "name": "that", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "that", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "thing", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "thing", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "those", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "those", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "abstract", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "abstract", + "kind": "keyword" + } + ] + }, + { + "name": "any", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "any", + "kind": "keyword" + } + ] + }, + { + "name": "Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "ArrayBuffer", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBuffer", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBuffer", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBufferConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Represents a raw buffer of binary data, which is used to store data for the\ndifferent typed arrays. ArrayBuffers cannot be read from or written to directly,\nbut can be passed to a typed array or DataView Object to interpret the raw\nbuffer as needed.", + "kind": "text" + } + ] + }, + { + "name": "as", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "as", + "kind": "keyword" + } + ] + }, + { + "name": "asserts", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "asserts", + "kind": "keyword" + } + ] + }, + { + "name": "async", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "async", + "kind": "keyword" + } + ] + }, + { + "name": "await", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "await", + "kind": "keyword" + } + ] + }, + { + "name": "bigint", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "bigint", + "kind": "keyword" + } + ] + }, + { + "name": "boolean", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "boolean", + "kind": "keyword" + } + ] + }, + { + "name": "Boolean", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Boolean", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Boolean", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "BooleanConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "break", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "break", + "kind": "keyword" + } + ] + }, + { + "name": "case", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "case", + "kind": "keyword" + } + ] + }, + { + "name": "catch", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "catch", + "kind": "keyword" + } + ] + }, + { + "name": "class", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "class", + "kind": "keyword" + } + ] + }, + { + "name": "const", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "const", + "kind": "keyword" + } + ] + }, + { + "name": "continue", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "continue", + "kind": "keyword" + } + ] + }, + { + "name": "DataView", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataView", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataView", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataViewConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "Date", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DateConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Enables basic storage and retrieval of dates and times.", + "kind": "text" + } + ] + }, + { + "name": "debugger", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "debugger", + "kind": "keyword" + } + ] + }, + { + "name": "declare", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "declare", + "kind": "keyword" + } + ] + }, + { + "name": "decodeURI", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decodeURI", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "encodedURI", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Gets the unencoded version of an encoded Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "encodedURI", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "decodeURIComponent", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decodeURIComponent", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "encodedURIComponent", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "encodedURIComponent", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "default", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "default", + "kind": "keyword" + } + ] + }, + { + "name": "delete", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "delete", + "kind": "keyword" + } + ] + }, + { + "name": "do", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "do", + "kind": "keyword" + } + ] + }, + { + "name": "else", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "else", + "kind": "keyword" + } + ] + }, + { + "name": "encodeURI", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "encodeURI", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "uri", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Encodes a text string as a valid Uniform Resource Identifier (URI)", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "uri", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an unencoded URI.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "encodeURIComponent", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "encodeURIComponent", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "uriComponent", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Encodes a text string as a valid component of a Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "uriComponent", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an unencoded URI component.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "enum", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "enum", + "kind": "keyword" + } + ] + }, + { + "name": "Error", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Error", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Error", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "eval", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "eval", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Evaluates JavaScript code and executes it.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "x", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "EvalError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "export", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "export", + "kind": "keyword" + } + ] + }, + { + "name": "extends", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "extends", + "kind": "keyword" + } + ] + }, + { + "name": "false", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "false", + "kind": "keyword" + } + ] + }, + { + "name": "finally", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "finally", + "kind": "keyword" + } + ] + }, + { + "name": "Float32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\nof bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Float64Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 64-bit float values. The contents are initialized to 0. If the requested\nnumber of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "for", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "for", + "kind": "keyword" + } + ] + }, + { + "name": "function", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + } + ] + }, + { + "name": "Function", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Function", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Function", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FunctionConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Creates a new function.", + "kind": "text" + } + ] + }, + { + "name": "globalThis", + "kind": "module", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalThis", + "kind": "moduleName" + } + ], + "documentation": [] + }, + { + "name": "if", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "if", + "kind": "keyword" + } + ] + }, + { + "name": "implements", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "implements", + "kind": "keyword" + } + ] + }, + { + "name": "import", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + } + ] + }, + { + "name": "in", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "in", + "kind": "keyword" + } + ] + }, + { + "name": "infer", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "infer", + "kind": "keyword" + } + ] + }, + { + "name": "Infinity", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Infinity", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [] + }, + { + "name": "instanceof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "instanceof", + "kind": "keyword" + } + ] + }, + { + "name": "Int16Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 16-bit signed integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Int32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit signed integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Int8Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit integer values. The contents are initialized to 0. If the requested\nnumber of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "interface", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + } + ] + }, + { + "name": "Intl", + "kind": "module", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Intl", + "kind": "moduleName" + } + ], + "documentation": [] + }, + { + "name": "isFinite", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isFinite", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Determines whether a supplied number is finite.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "number", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "isNaN", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isNaN", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "number", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "JSON", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + } + ], + "documentation": [ + { + "text": "An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.", + "kind": "text" + } + ] + }, + { + "name": "keyof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "keyof", + "kind": "keyword" + } + ] + }, + { + "name": "let", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "let", + "kind": "keyword" + } + ] + }, + { + "name": "Math", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + } + ], + "documentation": [ + { + "text": "An intrinsic object that provides basic mathematics functionality and constants.", + "kind": "text" + } + ] + }, + { + "name": "module", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "module", + "kind": "keyword" + } + ] + }, + { + "name": "namespace", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + } + ] + }, + { + "name": "NaN", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NaN", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [] + }, + { + "name": "never", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "never", + "kind": "keyword" + } + ] + }, + { + "name": "new", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "new", + "kind": "keyword" + } + ] + }, + { + "name": "null", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "null", + "kind": "keyword" + } + ] + }, + { + "name": "number", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "number", + "kind": "keyword" + } + ] + }, + { + "name": "Number", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Number", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Number", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NumberConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers.", + "kind": "text" + } + ] + }, + { + "name": "object", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "object", + "kind": "keyword" + } + ] + }, + { + "name": "Object", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Object", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Object", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ObjectConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Provides functionality common to all JavaScript objects.", + "kind": "text" + } + ] + }, + { + "name": "package", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "package", + "kind": "keyword" + } + ] + }, + { + "name": "parseFloat", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "parseFloat", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Converts a string to a floating-point number.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "parseInt", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "parseInt", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "radix", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Converts a string to an integer.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "radix", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in `string`.\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\nAll other strings are considered decimal.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "RangeError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "readonly", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "readonly", + "kind": "keyword" + } + ] + }, + { + "name": "ReferenceError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "RegExp", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExp", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExp", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExpConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "return", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "return", + "kind": "keyword" + } + ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] + }, + { + "name": "string", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "string", + "kind": "keyword" + } + ] + }, + { + "name": "String", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "String", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "String", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "StringConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Allows manipulation and formatting of text strings and determination and location of substrings within strings.", + "kind": "text" + } + ] + }, + { + "name": "super", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "super", + "kind": "keyword" + } + ] + }, + { + "name": "switch", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "switch", + "kind": "keyword" + } + ] + }, + { + "name": "symbol", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "symbol", + "kind": "keyword" + } + ] + }, + { + "name": "SyntaxError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "this", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "this", + "kind": "keyword" + } + ] + }, + { + "name": "throw", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "throw", + "kind": "keyword" + } + ] + }, + { + "name": "true", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "true", + "kind": "keyword" + } + ] + }, + { + "name": "try", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "try", + "kind": "keyword" + } + ] + }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, + { + "name": "TypeError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "typeof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "typeof", + "kind": "keyword" + } + ] + }, + { + "name": "Uint16Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint8Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint8ClampedArray", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArray", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArray", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.\nIf the requested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "undefined", + "kind": "var", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "undefined", + "kind": "propertyName" + } + ], + "documentation": [] + }, + { + "name": "unique", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "unique", + "kind": "keyword" + } + ] + }, + { + "name": "unknown", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "unknown", + "kind": "keyword" + } + ] + }, + { + "name": "URIError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "var", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + } + ] + }, + { + "name": "void", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "void", + "kind": "keyword" + } + ] + }, + { + "name": "while", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "while", + "kind": "keyword" + } + ] + }, + { + "name": "with", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "with", + "kind": "keyword" + } + ] + }, + { + "name": "yield", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "yield", + "kind": "keyword" + } + ] + }, + { + "name": "escape", + "kind": "function", + "kindModifiers": "deprecated,declare", + "sortText": "z15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "escape", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.", + "kind": "text" + } + ], + "tags": [ + { + "name": "deprecated", + "text": [ + { + "text": "A legacy feature for browser compatibility", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] + } + ] + }, + { + "name": "unescape", + "kind": "function", + "kindModifiers": "deprecated,declare", + "sortText": "z15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "unescape", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Computes a new string in which hexadecimal escape sequences are replaced with the character that it represents.", + "kind": "text" + } + ], + "tags": [ + { + "name": "deprecated", + "text": [ + { + "text": "A legacy feature for browser compatibility", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] + } + ] + } + ] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 119, + "name": "3" + }, + "item": { + "flags": 0, + "isGlobalCompletion": true, + "isMemberCompletion": false, + "isNewIdentifierLocation": false, + "optionalReplacementSpan": { + "start": 118, + "length": 1 + }, + "entries": [ + { + "name": "f", + "kind": "const", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [] + }, + { + "name": "that", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "that", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "thing", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "thing", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "those", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "those", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "abstract", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "abstract", + "kind": "keyword" + } + ] + }, + { + "name": "any", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "any", + "kind": "keyword" + } + ] + }, + { + "name": "Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "ArrayBuffer", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBuffer", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBuffer", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBufferConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Represents a raw buffer of binary data, which is used to store data for the\ndifferent typed arrays. ArrayBuffers cannot be read from or written to directly,\nbut can be passed to a typed array or DataView Object to interpret the raw\nbuffer as needed.", + "kind": "text" + } + ] + }, + { + "name": "as", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "as", + "kind": "keyword" + } + ] + }, + { + "name": "assert", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "assert", + "kind": "keyword" + } + ] + }, + { + "name": "asserts", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "asserts", + "kind": "keyword" + } + ] + }, + { + "name": "async", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "async", + "kind": "keyword" + } + ] + }, + { + "name": "await", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "await", + "kind": "keyword" + } + ] + }, + { + "name": "bigint", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "bigint", + "kind": "keyword" + } + ] + }, + { + "name": "boolean", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "boolean", + "kind": "keyword" + } + ] + }, + { + "name": "Boolean", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Boolean", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Boolean", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "BooleanConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "break", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "break", + "kind": "keyword" + } + ] + }, + { + "name": "case", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "case", + "kind": "keyword" + } + ] + }, + { + "name": "catch", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "catch", + "kind": "keyword" + } + ] + }, + { + "name": "class", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "class", + "kind": "keyword" + } + ] + }, + { + "name": "const", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "const", + "kind": "keyword" + } + ] + }, + { + "name": "continue", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "continue", + "kind": "keyword" + } + ] + }, + { + "name": "DataView", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataView", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataView", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataViewConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "Date", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DateConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Enables basic storage and retrieval of dates and times.", + "kind": "text" + } + ] + }, + { + "name": "debugger", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "debugger", + "kind": "keyword" + } + ] + }, + { + "name": "declare", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "declare", + "kind": "keyword" + } + ] + }, + { + "name": "decodeURI", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decodeURI", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "encodedURI", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Gets the unencoded version of an encoded Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "encodedURI", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "decodeURIComponent", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decodeURIComponent", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "encodedURIComponent", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "encodedURIComponent", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "default", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "default", + "kind": "keyword" + } + ] + }, + { + "name": "delete", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "delete", + "kind": "keyword" + } + ] + }, + { + "name": "do", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "do", + "kind": "keyword" + } + ] + }, + { + "name": "else", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "else", + "kind": "keyword" + } + ] + }, + { + "name": "encodeURI", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "encodeURI", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "uri", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Encodes a text string as a valid Uniform Resource Identifier (URI)", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "uri", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an unencoded URI.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "encodeURIComponent", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "encodeURIComponent", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "uriComponent", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Encodes a text string as a valid component of a Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "uriComponent", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an unencoded URI component.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "enum", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "enum", + "kind": "keyword" + } + ] + }, + { + "name": "Error", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Error", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Error", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "eval", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "eval", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Evaluates JavaScript code and executes it.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "x", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "EvalError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "export", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "export", + "kind": "keyword" + } + ] + }, + { + "name": "extends", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "extends", + "kind": "keyword" + } + ] + }, + { + "name": "false", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "false", + "kind": "keyword" + } + ] + }, + { + "name": "finally", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "finally", + "kind": "keyword" + } + ] + }, + { + "name": "Float32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\nof bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Float64Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 64-bit float values. The contents are initialized to 0. If the requested\nnumber of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "for", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "for", + "kind": "keyword" + } + ] + }, + { + "name": "function", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + } + ] + }, + { + "name": "Function", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Function", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Function", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FunctionConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Creates a new function.", + "kind": "text" + } + ] + }, + { + "name": "globalThis", + "kind": "module", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalThis", + "kind": "moduleName" + } + ], + "documentation": [] + }, + { + "name": "if", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "if", + "kind": "keyword" + } + ] + }, + { + "name": "implements", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "implements", + "kind": "keyword" + } + ] + }, + { + "name": "import", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + } + ] + }, + { + "name": "in", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "in", + "kind": "keyword" + } + ] + }, + { + "name": "infer", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "infer", + "kind": "keyword" + } + ] + }, + { + "name": "Infinity", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Infinity", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [] + }, + { + "name": "instanceof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "instanceof", + "kind": "keyword" + } + ] + }, + { + "name": "Int16Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 16-bit signed integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Int32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit signed integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Int8Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit integer values. The contents are initialized to 0. If the requested\nnumber of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "interface", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + } + ] + }, + { + "name": "Intl", + "kind": "module", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Intl", + "kind": "moduleName" + } + ], + "documentation": [] + }, + { + "name": "isFinite", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isFinite", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Determines whether a supplied number is finite.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "number", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "isNaN", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isNaN", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "number", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "JSON", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + } + ], + "documentation": [ + { + "text": "An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.", + "kind": "text" + } + ] + }, + { + "name": "keyof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "keyof", + "kind": "keyword" + } + ] + }, + { + "name": "let", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "let", + "kind": "keyword" + } + ] + }, + { + "name": "Math", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + } + ], + "documentation": [ + { + "text": "An intrinsic object that provides basic mathematics functionality and constants.", + "kind": "text" + } + ] + }, + { + "name": "module", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "module", + "kind": "keyword" + } + ] + }, + { + "name": "namespace", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + } + ] + }, + { + "name": "NaN", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NaN", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [] + }, + { + "name": "never", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "never", + "kind": "keyword" + } + ] + }, + { + "name": "new", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "new", + "kind": "keyword" + } + ] + }, + { + "name": "null", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "null", + "kind": "keyword" + } + ] + }, + { + "name": "number", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "number", + "kind": "keyword" + } + ] + }, + { + "name": "Number", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Number", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Number", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NumberConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers.", + "kind": "text" + } + ] + }, + { + "name": "object", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "object", + "kind": "keyword" + } + ] + }, + { + "name": "Object", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Object", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Object", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ObjectConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Provides functionality common to all JavaScript objects.", + "kind": "text" + } + ] + }, + { + "name": "package", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "package", + "kind": "keyword" + } + ] + }, + { + "name": "parseFloat", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "parseFloat", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Converts a string to a floating-point number.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "parseInt", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "parseInt", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "radix", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Converts a string to an integer.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "radix", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in `string`.\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\nAll other strings are considered decimal.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "RangeError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "readonly", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "readonly", + "kind": "keyword" + } + ] + }, + { + "name": "ReferenceError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "RegExp", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExp", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExp", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExpConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "return", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "return", + "kind": "keyword" + } + ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] + }, + { + "name": "string", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "string", + "kind": "keyword" + } + ] + }, + { + "name": "String", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "String", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "String", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "StringConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Allows manipulation and formatting of text strings and determination and location of substrings within strings.", + "kind": "text" + } + ] + }, + { + "name": "super", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "super", + "kind": "keyword" + } + ] + }, + { + "name": "switch", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "switch", + "kind": "keyword" + } + ] + }, + { + "name": "symbol", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "symbol", + "kind": "keyword" + } + ] + }, + { + "name": "SyntaxError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "this", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "this", + "kind": "keyword" + } + ] + }, + { + "name": "throw", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "throw", + "kind": "keyword" + } + ] + }, + { + "name": "true", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "true", + "kind": "keyword" + } + ] + }, + { + "name": "try", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "try", + "kind": "keyword" + } + ] + }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, + { + "name": "TypeError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "typeof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "typeof", + "kind": "keyword" + } + ] + }, + { + "name": "Uint16Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint8Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint8ClampedArray", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArray", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArray", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.\nIf the requested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "undefined", + "kind": "var", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "undefined", + "kind": "propertyName" + } + ], + "documentation": [] + }, + { + "name": "unique", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "unique", + "kind": "keyword" + } + ] + }, + { + "name": "unknown", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "unknown", + "kind": "keyword" + } + ] + }, + { + "name": "URIError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "var", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + } + ] + }, + { + "name": "void", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "void", + "kind": "keyword" + } + ] + }, + { + "name": "while", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "while", + "kind": "keyword" + } + ] + }, + { + "name": "with", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "with", + "kind": "keyword" + } + ] + }, + { + "name": "yield", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "yield", + "kind": "keyword" + } + ] + }, + { + "name": "escape", + "kind": "function", + "kindModifiers": "deprecated,declare", + "sortText": "z15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "escape", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.", + "kind": "text" + } + ], + "tags": [ + { + "name": "deprecated", + "text": [ + { + "text": "A legacy feature for browser compatibility", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] + } + ] + }, + { + "name": "unescape", + "kind": "function", + "kindModifiers": "deprecated,declare", + "sortText": "z15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "unescape", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Computes a new string in which hexadecimal escape sequences are replaced with the character that it represents.", + "kind": "text" + } + ], + "tags": [ + { + "name": "deprecated", + "text": [ + { + "text": "A legacy feature for browser compatibility", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] + } + ] + } + ] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 151, + "name": "4" + }, + "item": { + "flags": 0, + "isGlobalCompletion": true, + "isMemberCompletion": false, + "isNewIdentifierLocation": false, + "entries": [ + { + "name": "f", + "kind": "const", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [] + }, + { + "name": "that", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "that", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "thing", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "thing", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "those", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "those", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "abstract", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "abstract", + "kind": "keyword" + } + ] + }, + { + "name": "any", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "any", + "kind": "keyword" + } + ] + }, + { + "name": "Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "ArrayBuffer", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBuffer", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBuffer", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBufferConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Represents a raw buffer of binary data, which is used to store data for the\ndifferent typed arrays. ArrayBuffers cannot be read from or written to directly,\nbut can be passed to a typed array or DataView Object to interpret the raw\nbuffer as needed.", + "kind": "text" + } + ] + }, + { + "name": "as", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "as", + "kind": "keyword" + } + ] + }, + { + "name": "asserts", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "asserts", + "kind": "keyword" + } + ] + }, + { + "name": "async", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "async", + "kind": "keyword" + } + ] + }, + { + "name": "await", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "await", + "kind": "keyword" + } + ] + }, + { + "name": "bigint", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "bigint", + "kind": "keyword" + } + ] + }, + { + "name": "boolean", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "boolean", + "kind": "keyword" + } + ] + }, + { + "name": "Boolean", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Boolean", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Boolean", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "BooleanConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "break", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "break", + "kind": "keyword" + } + ] + }, + { + "name": "case", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "case", + "kind": "keyword" + } + ] + }, + { + "name": "catch", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "catch", + "kind": "keyword" + } + ] + }, + { + "name": "class", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "class", + "kind": "keyword" + } + ] + }, + { + "name": "const", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "const", + "kind": "keyword" + } + ] + }, + { + "name": "continue", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "continue", + "kind": "keyword" + } + ] + }, + { + "name": "DataView", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataView", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataView", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataViewConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "Date", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DateConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Enables basic storage and retrieval of dates and times.", + "kind": "text" + } + ] + }, + { + "name": "debugger", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "debugger", + "kind": "keyword" + } + ] + }, + { + "name": "declare", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "declare", + "kind": "keyword" + } + ] + }, + { + "name": "decodeURI", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decodeURI", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "encodedURI", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Gets the unencoded version of an encoded Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "encodedURI", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "decodeURIComponent", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decodeURIComponent", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "encodedURIComponent", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "encodedURIComponent", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "default", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "default", + "kind": "keyword" + } + ] + }, + { + "name": "delete", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "delete", + "kind": "keyword" + } + ] + }, + { + "name": "do", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "do", + "kind": "keyword" + } + ] + }, + { + "name": "else", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "else", + "kind": "keyword" + } + ] + }, + { + "name": "encodeURI", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "encodeURI", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "uri", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Encodes a text string as a valid Uniform Resource Identifier (URI)", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "uri", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an unencoded URI.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "encodeURIComponent", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "encodeURIComponent", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "uriComponent", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Encodes a text string as a valid component of a Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "uriComponent", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an unencoded URI component.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "enum", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "enum", + "kind": "keyword" + } + ] + }, + { + "name": "Error", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Error", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Error", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "eval", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "eval", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Evaluates JavaScript code and executes it.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "x", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "EvalError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "export", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "export", + "kind": "keyword" + } + ] + }, + { + "name": "extends", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "extends", + "kind": "keyword" + } + ] + }, + { + "name": "false", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "false", + "kind": "keyword" + } + ] + }, + { + "name": "finally", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "finally", + "kind": "keyword" + } + ] + }, + { + "name": "Float32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\nof bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Float64Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 64-bit float values. The contents are initialized to 0. If the requested\nnumber of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "for", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "for", + "kind": "keyword" + } + ] + }, + { + "name": "function", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + } + ] + }, + { + "name": "Function", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Function", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Function", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FunctionConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Creates a new function.", + "kind": "text" + } + ] + }, + { + "name": "globalThis", + "kind": "module", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalThis", + "kind": "moduleName" + } + ], + "documentation": [] + }, + { + "name": "if", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "if", + "kind": "keyword" + } + ] + }, + { + "name": "implements", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "implements", + "kind": "keyword" + } + ] + }, + { + "name": "import", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + } + ] + }, + { + "name": "in", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "in", + "kind": "keyword" + } + ] + }, + { + "name": "infer", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "infer", + "kind": "keyword" + } + ] + }, + { + "name": "Infinity", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Infinity", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [] + }, + { + "name": "instanceof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "instanceof", + "kind": "keyword" + } + ] + }, + { + "name": "Int16Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 16-bit signed integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Int32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit signed integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Int8Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit integer values. The contents are initialized to 0. If the requested\nnumber of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "interface", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + } + ] + }, + { + "name": "Intl", + "kind": "module", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Intl", + "kind": "moduleName" + } + ], + "documentation": [] + }, + { + "name": "isFinite", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isFinite", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Determines whether a supplied number is finite.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "number", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "isNaN", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isNaN", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "number", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "JSON", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + } + ], + "documentation": [ + { + "text": "An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.", + "kind": "text" + } + ] + }, + { + "name": "keyof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "keyof", + "kind": "keyword" + } + ] + }, + { + "name": "let", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "let", + "kind": "keyword" + } + ] + }, + { + "name": "Math", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + } + ], + "documentation": [ + { + "text": "An intrinsic object that provides basic mathematics functionality and constants.", + "kind": "text" + } + ] + }, + { + "name": "module", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "module", + "kind": "keyword" + } + ] + }, + { + "name": "namespace", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + } + ] + }, + { + "name": "NaN", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NaN", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [] + }, + { + "name": "never", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "never", + "kind": "keyword" + } + ] + }, + { + "name": "new", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "new", + "kind": "keyword" + } + ] + }, + { + "name": "null", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "null", + "kind": "keyword" + } + ] + }, + { + "name": "number", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "number", + "kind": "keyword" + } + ] + }, + { + "name": "Number", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Number", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Number", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NumberConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers.", + "kind": "text" + } + ] + }, + { + "name": "object", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "object", + "kind": "keyword" + } + ] + }, + { + "name": "Object", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Object", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Object", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ObjectConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Provides functionality common to all JavaScript objects.", + "kind": "text" + } + ] + }, + { + "name": "package", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "package", + "kind": "keyword" + } + ] + }, + { + "name": "parseFloat", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "parseFloat", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Converts a string to a floating-point number.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "parseInt", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "parseInt", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "radix", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Converts a string to an integer.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "radix", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in `string`.\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\nAll other strings are considered decimal.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "RangeError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "readonly", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "readonly", + "kind": "keyword" + } + ] + }, + { + "name": "ReferenceError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "RegExp", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExp", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExp", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExpConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "return", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "return", + "kind": "keyword" + } + ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] + }, + { + "name": "string", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "string", + "kind": "keyword" + } + ] + }, + { + "name": "String", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "String", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "String", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "StringConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Allows manipulation and formatting of text strings and determination and location of substrings within strings.", + "kind": "text" + } + ] + }, + { + "name": "super", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "super", + "kind": "keyword" + } + ] + }, + { + "name": "switch", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "switch", + "kind": "keyword" + } + ] + }, + { + "name": "symbol", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "symbol", + "kind": "keyword" + } + ] + }, + { + "name": "SyntaxError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "this", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "this", + "kind": "keyword" + } + ] + }, + { + "name": "throw", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "throw", + "kind": "keyword" + } + ] + }, + { + "name": "true", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "true", + "kind": "keyword" + } + ] + }, + { + "name": "try", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "try", + "kind": "keyword" + } + ] + }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, + { + "name": "TypeError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "typeof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "typeof", + "kind": "keyword" + } + ] + }, + { + "name": "Uint16Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint8Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint8ClampedArray", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArray", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArray", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.\nIf the requested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "undefined", + "kind": "var", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "undefined", + "kind": "propertyName" + } + ], + "documentation": [] + }, + { + "name": "unique", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "unique", + "kind": "keyword" + } + ] + }, + { + "name": "unknown", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "unknown", + "kind": "keyword" + } + ] + }, + { + "name": "URIError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "var", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + } + ] + }, + { + "name": "void", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "void", + "kind": "keyword" + } + ] + }, + { + "name": "while", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "while", + "kind": "keyword" + } + ] + }, + { + "name": "with", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "with", + "kind": "keyword" + } + ] + }, + { + "name": "yield", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "yield", + "kind": "keyword" + } + ] + }, + { + "name": "escape", + "kind": "function", + "kindModifiers": "deprecated,declare", + "sortText": "z15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "escape", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.", + "kind": "text" + } + ], + "tags": [ + { + "name": "deprecated", + "text": [ + { + "text": "A legacy feature for browser compatibility", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] + } + ] + }, + { + "name": "unescape", + "kind": "function", + "kindModifiers": "deprecated,declare", + "sortText": "z15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "unescape", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Computes a new string in which hexadecimal escape sequences are replaced with the character that it represents.", + "kind": "text" + } + ], + "tags": [ + { + "name": "deprecated", + "text": [ + { + "text": "A legacy feature for browser compatibility", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] + } + ] + } + ] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/a.ts", + "position": 162, + "name": "5" + }, + "item": { + "flags": 0, + "isGlobalCompletion": false, + "isMemberCompletion": false, + "isNewIdentifierLocation": false, + "entries": [ + { + "name": "f", + "kind": "const", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [] + }, + { + "name": "that", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "that", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "thing", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "thing", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "those", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "those", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "abstract", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "abstract", + "kind": "keyword" + } + ] + }, + { + "name": "any", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "any", + "kind": "keyword" + } + ] + }, + { + "name": "Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "ArrayBuffer", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBuffer", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBuffer", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBufferConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Represents a raw buffer of binary data, which is used to store data for the\ndifferent typed arrays. ArrayBuffers cannot be read from or written to directly,\nbut can be passed to a typed array or DataView Object to interpret the raw\nbuffer as needed.", + "kind": "text" + } + ] + }, + { + "name": "as", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "as", + "kind": "keyword" + } + ] + }, + { + "name": "asserts", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "asserts", + "kind": "keyword" + } + ] + }, + { + "name": "async", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "async", + "kind": "keyword" + } + ] + }, + { + "name": "await", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "await", + "kind": "keyword" + } + ] + }, + { + "name": "bigint", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "bigint", + "kind": "keyword" + } + ] + }, + { + "name": "boolean", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "boolean", + "kind": "keyword" + } + ] + }, + { + "name": "Boolean", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Boolean", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Boolean", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "BooleanConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "break", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "break", + "kind": "keyword" + } + ] + }, + { + "name": "case", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "case", + "kind": "keyword" + } + ] + }, + { + "name": "catch", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "catch", + "kind": "keyword" + } + ] + }, + { + "name": "class", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "class", + "kind": "keyword" + } + ] + }, + { + "name": "const", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "const", + "kind": "keyword" + } + ] + }, + { + "name": "continue", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "continue", + "kind": "keyword" + } + ] + }, + { + "name": "DataView", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataView", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataView", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataViewConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "Date", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DateConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Enables basic storage and retrieval of dates and times.", + "kind": "text" + } + ] + }, + { + "name": "debugger", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "debugger", + "kind": "keyword" + } + ] + }, + { + "name": "declare", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "declare", + "kind": "keyword" + } + ] + }, + { + "name": "decodeURI", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decodeURI", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "encodedURI", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Gets the unencoded version of an encoded Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "encodedURI", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "decodeURIComponent", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decodeURIComponent", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "encodedURIComponent", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "encodedURIComponent", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "default", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "default", + "kind": "keyword" + } + ] + }, + { + "name": "delete", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "delete", + "kind": "keyword" + } + ] + }, + { + "name": "do", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "do", + "kind": "keyword" + } + ] + }, + { + "name": "else", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "else", + "kind": "keyword" + } + ] + }, + { + "name": "encodeURI", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "encodeURI", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "uri", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Encodes a text string as a valid Uniform Resource Identifier (URI)", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "uri", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an unencoded URI.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "encodeURIComponent", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "encodeURIComponent", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "uriComponent", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Encodes a text string as a valid component of a Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "uriComponent", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an unencoded URI component.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "enum", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "enum", + "kind": "keyword" + } + ] + }, + { + "name": "Error", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Error", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Error", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "eval", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "eval", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Evaluates JavaScript code and executes it.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "x", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "EvalError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "export", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "export", + "kind": "keyword" + } + ] + }, + { + "name": "extends", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "extends", + "kind": "keyword" + } + ] + }, + { + "name": "false", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "false", + "kind": "keyword" + } + ] + }, + { + "name": "finally", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "finally", + "kind": "keyword" + } + ] + }, + { + "name": "Float32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\nof bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Float64Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 64-bit float values. The contents are initialized to 0. If the requested\nnumber of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "for", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "for", + "kind": "keyword" + } + ] + }, + { + "name": "function", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + } + ] + }, + { + "name": "Function", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Function", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Function", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FunctionConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Creates a new function.", + "kind": "text" + } + ] + }, + { + "name": "globalThis", + "kind": "module", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalThis", + "kind": "moduleName" + } + ], + "documentation": [] + }, + { + "name": "if", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "if", + "kind": "keyword" + } + ] + }, + { + "name": "implements", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "implements", + "kind": "keyword" + } + ] + }, + { + "name": "import", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + } + ] + }, + { + "name": "in", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "in", + "kind": "keyword" + } + ] + }, + { + "name": "infer", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "infer", + "kind": "keyword" + } + ] + }, + { + "name": "Infinity", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Infinity", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [] + }, + { + "name": "instanceof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "instanceof", + "kind": "keyword" + } + ] + }, + { + "name": "Int16Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 16-bit signed integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Int32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit signed integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Int8Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit integer values. The contents are initialized to 0. If the requested\nnumber of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "interface", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + } + ] + }, + { + "name": "Intl", + "kind": "module", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Intl", + "kind": "moduleName" + } + ], + "documentation": [] + }, + { + "name": "isFinite", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isFinite", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Determines whether a supplied number is finite.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "number", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "isNaN", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isNaN", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "number", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "JSON", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + } + ], + "documentation": [ + { + "text": "An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.", + "kind": "text" + } + ] + }, + { + "name": "keyof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "keyof", + "kind": "keyword" + } + ] + }, + { + "name": "let", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "let", + "kind": "keyword" + } + ] + }, + { + "name": "Math", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + } + ], + "documentation": [ + { + "text": "An intrinsic object that provides basic mathematics functionality and constants.", + "kind": "text" + } + ] + }, + { + "name": "module", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "module", + "kind": "keyword" + } + ] + }, + { + "name": "namespace", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + } + ] + }, + { + "name": "NaN", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NaN", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [] + }, + { + "name": "never", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "never", + "kind": "keyword" + } + ] + }, + { + "name": "new", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "new", + "kind": "keyword" + } + ] + }, + { + "name": "null", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "null", + "kind": "keyword" + } + ] + }, + { + "name": "number", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "number", + "kind": "keyword" + } + ] + }, + { + "name": "Number", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Number", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Number", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NumberConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers.", + "kind": "text" + } + ] + }, + { + "name": "object", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "object", + "kind": "keyword" + } + ] + }, + { + "name": "Object", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Object", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Object", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ObjectConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Provides functionality common to all JavaScript objects.", + "kind": "text" + } + ] + }, + { + "name": "package", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "package", + "kind": "keyword" + } + ] + }, + { + "name": "parseFloat", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "parseFloat", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Converts a string to a floating-point number.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "parseInt", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "parseInt", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "radix", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Converts a string to an integer.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "radix", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in `string`.\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\nAll other strings are considered decimal.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "RangeError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "readonly", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "readonly", + "kind": "keyword" + } + ] + }, + { + "name": "ReferenceError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "RegExp", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExp", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExp", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExpConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "return", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "return", + "kind": "keyword" + } + ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] + }, + { + "name": "string", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "string", + "kind": "keyword" + } + ] + }, + { + "name": "String", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "String", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "String", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "StringConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Allows manipulation and formatting of text strings and determination and location of substrings within strings.", + "kind": "text" + } + ] + }, + { + "name": "super", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "super", + "kind": "keyword" + } + ] + }, + { + "name": "switch", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "switch", + "kind": "keyword" + } + ] + }, + { + "name": "symbol", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "symbol", + "kind": "keyword" + } + ] + }, + { + "name": "SyntaxError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "this", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "this", + "kind": "keyword" + } + ] + }, + { + "name": "throw", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "throw", + "kind": "keyword" + } + ] + }, + { + "name": "true", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "true", + "kind": "keyword" + } + ] + }, + { + "name": "try", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "try", + "kind": "keyword" + } + ] + }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, + { + "name": "TypeError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "typeof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "typeof", + "kind": "keyword" + } + ] + }, + { + "name": "Uint16Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint8Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint8ClampedArray", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArray", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArray", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.\nIf the requested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "undefined", + "kind": "var", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "undefined", + "kind": "propertyName" + } + ], + "documentation": [] + }, + { + "name": "unique", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "unique", + "kind": "keyword" + } + ] + }, + { + "name": "unknown", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "unknown", + "kind": "keyword" + } + ] + }, + { + "name": "URIError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "var", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + } + ] + }, + { + "name": "void", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "void", + "kind": "keyword" + } + ] + }, + { + "name": "while", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "while", + "kind": "keyword" + } + ] + }, + { + "name": "with", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "with", + "kind": "keyword" + } + ] + }, + { + "name": "yield", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "yield", + "kind": "keyword" + } + ] + }, + { + "name": "escape", + "kind": "function", + "kindModifiers": "deprecated,declare", + "sortText": "z15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "escape", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.", + "kind": "text" + } + ], + "tags": [ + { + "name": "deprecated", + "text": [ + { + "text": "A legacy feature for browser compatibility", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] + } + ] + }, + { + "name": "unescape", + "kind": "function", + "kindModifiers": "deprecated,declare", + "sortText": "z15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "unescape", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Computes a new string in which hexadecimal escape sequences are replaced with the character that it represents.", + "kind": "text" + } + ], + "tags": [ + { + "name": "deprecated", + "text": [ + { + "text": "A legacy feature for browser compatibility", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] + } + ] + } + ] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/b.js", + "position": 31, + "name": "js" + }, + "item": { + "flags": 0, + "isGlobalCompletion": true, + "isMemberCompletion": false, + "isNewIdentifierLocation": false, + "entries": [ + { + "name": "thing", + "kind": "alias", + "kindModifiers": "", + "sortText": "11", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "thing", + "kind": "aliasName" + } + ], + "documentation": [] + }, + { + "name": "Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "ArrayBuffer", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBuffer", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBuffer", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ArrayBufferConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Represents a raw buffer of binary data, which is used to store data for the\ndifferent typed arrays. ArrayBuffers cannot be read from or written to directly,\nbut can be passed to a typed array or DataView Object to interpret the raw\nbuffer as needed.", + "kind": "text" + } + ] + }, + { + "name": "as", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "as", + "kind": "keyword" + } + ] + }, + { + "name": "assert", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "assert", + "kind": "keyword" + } + ] + }, + { + "name": "asserts", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "asserts", + "kind": "keyword" + } + ] + }, + { + "name": "async", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "async", + "kind": "keyword" + } + ] + }, + { + "name": "await", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "await", + "kind": "keyword" + } + ] + }, + { + "name": "Boolean", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Boolean", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Boolean", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "BooleanConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "break", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "break", + "kind": "keyword" + } + ] + }, + { + "name": "case", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "case", + "kind": "keyword" + } + ] + }, + { + "name": "catch", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "catch", + "kind": "keyword" + } + ] + }, + { + "name": "class", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "class", + "kind": "keyword" + } + ] + }, + { + "name": "const", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "const", + "kind": "keyword" + } + ] + }, + { + "name": "continue", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "continue", + "kind": "keyword" + } + ] + }, + { + "name": "DataView", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataView", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataView", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DataViewConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "Date", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Date", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DateConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Enables basic storage and retrieval of dates and times.", + "kind": "text" + } + ] + }, + { + "name": "debugger", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "debugger", + "kind": "keyword" + } + ] + }, + { + "name": "decodeURI", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decodeURI", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "encodedURI", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Gets the unencoded version of an encoded Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "encodedURI", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "decodeURIComponent", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decodeURIComponent", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "encodedURIComponent", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "encodedURIComponent", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an encoded URI component.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "default", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "default", + "kind": "keyword" + } + ] + }, + { + "name": "delete", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "delete", + "kind": "keyword" + } + ] + }, + { + "name": "do", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "do", + "kind": "keyword" + } + ] + }, + { + "name": "else", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "else", + "kind": "keyword" + } + ] + }, + { + "name": "encodeURI", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "encodeURI", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "uri", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Encodes a text string as a valid Uniform Resource Identifier (URI)", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "uri", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an unencoded URI.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "encodeURIComponent", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "encodeURIComponent", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "uriComponent", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Encodes a text string as a valid component of a Uniform Resource Identifier (URI).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "uriComponent", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value representing an unencoded URI component.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "Error", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Error", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Error", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "eval", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "eval", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Evaluates JavaScript code and executes it.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "x", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A String value that contains valid JavaScript code.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "EvalError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "EvalErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "export", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "export", + "kind": "keyword" + } + ] + }, + { + "name": "extends", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "extends", + "kind": "keyword" + } + ] + }, + { + "name": "false", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "false", + "kind": "keyword" + } + ] + }, + { + "name": "finally", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "finally", + "kind": "keyword" + } + ] + }, + { + "name": "Float32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\nof bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Float64Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Float64ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 64-bit float values. The contents are initialized to 0. If the requested\nnumber of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "for", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "for", + "kind": "keyword" + } + ] + }, + { + "name": "function", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + } + ] + }, + { + "name": "Function", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Function", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Function", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "FunctionConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Creates a new function.", + "kind": "text" + } + ] + }, + { + "name": "globalThis", + "kind": "module", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalThis", + "kind": "moduleName" + } + ], + "documentation": [] + }, + { + "name": "if", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "if", + "kind": "keyword" + } + ] + }, + { + "name": "import", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "import", + "kind": "keyword" + } + ] + }, + { + "name": "in", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "in", + "kind": "keyword" + } + ] + }, + { + "name": "Infinity", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Infinity", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [] + }, + { + "name": "instanceof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "instanceof", + "kind": "keyword" + } + ] + }, + { + "name": "Int16Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int16ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 16-bit signed integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Int32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit signed integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Int8Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Int8ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit integer values. The contents are initialized to 0. If the requested\nnumber of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Intl", + "kind": "module", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Intl", + "kind": "moduleName" + } + ], + "documentation": [] + }, + { + "name": "isFinite", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isFinite", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Determines whether a supplied number is finite.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "number", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Any numeric value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "isNaN", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isNaN", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "number", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "number", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A numeric value.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "JSON", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSON", + "kind": "localName" + } + ], + "documentation": [ + { + "text": "An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.", + "kind": "text" + } + ] + }, + { + "name": "let", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "let", + "kind": "keyword" + } + ] + }, + { + "name": "Math", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Math", + "kind": "localName" + } + ], + "documentation": [ + { + "text": "An intrinsic object that provides basic mathematics functionality and constants.", + "kind": "text" + } + ] + }, + { + "name": "NaN", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NaN", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [] + }, + { + "name": "new", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "new", + "kind": "keyword" + } + ] + }, + { + "name": "null", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "null", + "kind": "keyword" + } + ] + }, + { + "name": "Number", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Number", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Number", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NumberConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers.", + "kind": "text" + } + ] + }, + { + "name": "Object", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Object", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Object", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ObjectConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Provides functionality common to all JavaScript objects.", + "kind": "text" + } + ] + }, + { + "name": "package", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "package", + "kind": "keyword" + } + ] + }, + { + "name": "parseFloat", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "parseFloat", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Converts a string to a floating-point number.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string that contains a floating-point number.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "parseInt", + "kind": "function", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "parseInt", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "radix", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Converts a string to an integer.", + "kind": "text" + } + ], + "tags": [ + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string to convert into a number.", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "radix", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A value between 2 and 36 that specifies the base of the number in `string`.\nIf this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\nAll other strings are considered decimal.", + "kind": "text" + } + ] + } + ] + }, + { + "name": "RangeError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RangeErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "ReferenceError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ReferenceErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "RegExp", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExp", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExp", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RegExpConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "return", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "return", + "kind": "keyword" + } + ] + }, + { + "name": "satisfies", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "satisfies", + "kind": "keyword" + } + ] + }, + { + "name": "String", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "String", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "String", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "StringConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "Allows manipulation and formatting of text strings and determination and location of substrings within strings.", + "kind": "text" + } + ] + }, + { + "name": "super", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "super", + "kind": "keyword" + } + ] + }, + { + "name": "switch", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "switch", + "kind": "keyword" + } + ] + }, + { + "name": "SyntaxError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SyntaxErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "this", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "this", + "kind": "keyword" + } + ] + }, + { + "name": "throw", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "throw", + "kind": "keyword" + } + ] + }, + { + "name": "true", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "true", + "kind": "keyword" + } + ] + }, + { + "name": "try", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "try", + "kind": "keyword" + } + ] + }, + { + "name": "TypeError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "TypeErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "typeof", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "typeof", + "kind": "keyword" + } + ] + }, + { + "name": "Uint16Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint16ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint32Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint32ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint8Array", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8Array", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8Array", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the\nrequested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "Uint8ClampedArray", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArray", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArray", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Uint8ClampedArrayConstructor", + "kind": "interfaceName" + } + ], + "documentation": [ + { + "text": "A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.\nIf the requested number of bytes could not be allocated an exception is raised.", + "kind": "text" + } + ] + }, + { + "name": "undefined", + "kind": "var", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "undefined", + "kind": "propertyName" + } + ], + "documentation": [] + }, + { + "name": "URIError", + "kind": "var", + "kindModifiers": "declare", + "sortText": "15", + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIError", + "kind": "localName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIError", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "URIErrorConstructor", + "kind": "interfaceName" + } + ], + "documentation": [] + }, + { + "name": "var", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "var", + "kind": "keyword" + } + ] + }, + { + "name": "void", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "void", + "kind": "keyword" + } + ] + }, + { + "name": "while", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "while", + "kind": "keyword" + } + ] + }, + { + "name": "with", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "with", + "kind": "keyword" + } + ] + }, + { + "name": "yield", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "yield", + "kind": "keyword" + } + ] + }, + { + "name": "escape", + "kind": "function", + "kindModifiers": "deprecated,declare", + "sortText": "z15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "escape", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.", + "kind": "text" + } + ], + "tags": [ + { + "name": "deprecated", + "text": [ + { + "text": "A legacy feature for browser compatibility", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] + } + ] + }, + { + "name": "unescape", + "kind": "function", + "kindModifiers": "deprecated,declare", + "sortText": "z15", + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "unescape", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "string", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "documentation": [ + { + "text": "Computes a new string in which hexadecimal escape sequences are replaced with the character that it represents.", + "kind": "text" + } + ], + "tags": [ + { + "name": "deprecated", + "text": [ + { + "text": "A legacy feature for browser compatibility", + "kind": "text" + } + ] + }, + { + "name": "param", + "text": [ + { + "text": "string", + "kind": "parameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A string value", + "kind": "text" + } + ] + } + ] + } + ] + } + } +] \ No newline at end of file diff --git a/tests/baselines/reference/getOccurrencesNonStringImportAttributes.baseline.jsonc b/tests/baselines/reference/getOccurrencesNonStringImportAttributes.baseline.jsonc new file mode 100644 index 0000000000000..ef51a0b9d0682 --- /dev/null +++ b/tests/baselines/reference/getOccurrencesNonStringImportAttributes.baseline.jsonc @@ -0,0 +1,4 @@ +// === documentHighlights === +// === /tests/cases/fourslash/getOccurrencesNonStringImportAttributes.ts === +// import * as react from "react" with { cache: /*HIGHLIGHTS*/0 }; +// react.Children; \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt b/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt index d11e612746a0c..c937b51391439 100644 --- a/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt @@ -8,7 +8,7 @@ 3.ts(4,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. 3.ts(5,26): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. 3.ts(7,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. -3.ts(8,11): message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments +3.ts(8,11): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments 3.ts(9,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. 3.ts(10,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. 3.ts(10,52): error TS1009: Trailing comma not allowed. @@ -65,7 +65,7 @@ !!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. const f = import() ~~~~~~~~ -!!! message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments +!!! message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments const g = import('./0', {}, {}) ~~ !!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. diff --git a/tests/baselines/reference/importAssertion1(module=esnext).errors.txt b/tests/baselines/reference/importAssertion1(module=esnext).errors.txt index df0fc98859fa5..e8100730813c4 100644 --- a/tests/baselines/reference/importAssertion1(module=esnext).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=esnext).errors.txt @@ -1,5 +1,5 @@ -3.ts(8,11): message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments -3.ts(9,11): message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments +3.ts(8,11): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments +3.ts(9,11): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments ==== 0.ts (0 errors) ==== @@ -33,10 +33,10 @@ const e = import('./0', foo()) const f = import() ~~~~~~~~ -!!! message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments +!!! message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments const g = import('./0', {}, {}) ~~~~~~~~~~~~~~~~~~~~~ -!!! message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments +!!! message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments const h = import('./0', { assert: { type: "json" }},) \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes1(module=commonjs).errors.txt b/tests/baselines/reference/importAttributes1(module=commonjs).errors.txt new file mode 100644 index 0000000000000..694896a8a8769 --- /dev/null +++ b/tests/baselines/reference/importAttributes1(module=commonjs).errors.txt @@ -0,0 +1,75 @@ +1.ts(1,14): error TS2856: Import attributes cannot be used with type-only imports or exports. +1.ts(2,28): error TS2856: Import attributes cannot be used with type-only imports or exports. +1.ts(3,28): error TS2856: Import attributes cannot be used with type-only imports or exports. +2.ts(1,28): error TS2856: Import attributes cannot be used with type-only imports or exports. +2.ts(2,38): error TS2856: Import attributes cannot be used with type-only imports or exports. +3.ts(2,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. +3.ts(3,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. +3.ts(4,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. +3.ts(5,26): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. +3.ts(7,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. +3.ts(8,11): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments +3.ts(9,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. +3.ts(10,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. +3.ts(10,50): error TS1009: Trailing comma not allowed. + + +==== 0.ts (0 errors) ==== + export const a = 1; + export const b = 2; + +==== 1.ts (3 errors) ==== + import './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + import { a, b } from './0' with { "type": "json" } + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + import * as foo from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + a; + b; + foo.a; + foo.b; +==== 2.ts (2 errors) ==== + import { a, b } from './0' with {} + ~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + a; + b; + c; + d; +==== 3.ts (9 errors) ==== + const a = import('./0') + const b = import('./0', { with: { type: "json" } }) + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. + const c = import('./0', { with: { type: "json", ttype: "typo" } }) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. + const d = import('./0', { with: {} }) + ~~~~~~~~~~~~ +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. + const dd = import('./0', {}) + ~~ +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. + 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', 'node16', or 'nodenext'. + const f = import() + ~~~~~~~~ +!!! message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments + const g = import('./0', {}, {}) + ~~ +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. + const h = import('./0', { with: { type: "json" }},) + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. + ~ +!!! error TS1009: Trailing comma not allowed. + \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes1(module=commonjs).js b/tests/baselines/reference/importAttributes1(module=commonjs).js new file mode 100644 index 0000000000000..efa8ccd637c10 --- /dev/null +++ b/tests/baselines/reference/importAttributes1(module=commonjs).js @@ -0,0 +1,89 @@ +//// [tests/cases/conformance/importAttributes/importAttributes1.ts] //// + +//// [0.ts] +export const a = 1; +export const b = 2; + +//// [1.ts] +import './0' with { type: "json" } +import { a, b } from './0' with { "type": "json" } +import * as foo from './0' with { type: "json" } +a; +b; +foo.a; +foo.b; +//// [2.ts] +import { a, b } from './0' with {} +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } +a; +b; +c; +d; +//// [3.ts] +const a = import('./0') +const b = import('./0', { with: { type: "json" } }) +const c = import('./0', { with: { type: "json", ttype: "typo" } }) +const d = import('./0', { with: {} }) +const dd = import('./0', {}) +declare function foo(): any; +const e = import('./0', foo()) +const f = import() +const g = import('./0', {}, {}) +const h = import('./0', { with: { 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; +declare const b: Promise; +declare const c: Promise; +declare const d: Promise; +declare const dd: Promise; +declare function foo(): any; +declare const e: Promise; +declare const f: Promise; +declare const g: Promise; +declare const h: Promise; diff --git a/tests/baselines/reference/importAttributes1(module=commonjs).symbols b/tests/baselines/reference/importAttributes1(module=commonjs).symbols new file mode 100644 index 0000000000000..65dc9f66362e7 --- /dev/null +++ b/tests/baselines/reference/importAttributes1(module=commonjs).symbols @@ -0,0 +1,105 @@ +//// [tests/cases/conformance/importAttributes/importAttributes1.ts] //// + +=== 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)) + +=== 1.ts === +import './0' with { type: "json" } +import { a, b } from './0' with { "type": "json" } +>a : Symbol(a, Decl(1.ts, 1, 8)) +>b : Symbol(b, Decl(1.ts, 1, 11)) + +import * as foo from './0' with { 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)) + +=== 2.ts === +import { a, b } from './0' with {} +>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' with { 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)) + +=== 3.ts === +const a = import('./0') +>a : Symbol(a, Decl(3.ts, 0, 5)) +>'./0' : Symbol("0", Decl(0.ts, 0, 0)) + +const b = import('./0', { with: { type: "json" } }) +>b : Symbol(b, Decl(3.ts, 1, 5)) +>'./0' : Symbol("0", Decl(0.ts, 0, 0)) +>with : Symbol(with, Decl(3.ts, 1, 25)) +>type : Symbol(type, Decl(3.ts, 1, 33)) + +const c = import('./0', { with: { type: "json", ttype: "typo" } }) +>c : Symbol(c, Decl(3.ts, 2, 5)) +>'./0' : Symbol("0", Decl(0.ts, 0, 0)) +>with : Symbol(with, Decl(3.ts, 2, 25)) +>type : Symbol(type, Decl(3.ts, 2, 33)) +>ttype : Symbol(ttype, Decl(3.ts, 2, 47)) + +const d = import('./0', { with: {} }) +>d : Symbol(d, Decl(3.ts, 3, 5)) +>'./0' : Symbol("0", Decl(0.ts, 0, 0)) +>with : Symbol(with, Decl(3.ts, 3, 25)) + +const dd = import('./0', {}) +>dd : Symbol(dd, Decl(3.ts, 4, 5)) +>'./0' : Symbol("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("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("0", Decl(0.ts, 0, 0)) + +const h = import('./0', { with: { type: "json" }},) +>h : Symbol(h, Decl(3.ts, 9, 5)) +>'./0' : Symbol("0", Decl(0.ts, 0, 0)) +>with : Symbol(with, Decl(3.ts, 9, 25)) +>type : Symbol(type, Decl(3.ts, 9, 33)) + diff --git a/tests/baselines/reference/importAttributes1(module=commonjs).types b/tests/baselines/reference/importAttributes1(module=commonjs).types new file mode 100644 index 0000000000000..fb1da06ede0e4 --- /dev/null +++ b/tests/baselines/reference/importAttributes1(module=commonjs).types @@ -0,0 +1,138 @@ +//// [tests/cases/conformance/importAttributes/importAttributes1.ts] //// + +=== 0.ts === +export const a = 1; +>a : 1 +>1 : 1 + +export const b = 2; +>b : 2 +>2 : 2 + +=== 1.ts === +import './0' with { type: "json" } +>type : any + +import { a, b } from './0' with { "type": "json" } +>a : 1 +>b : 2 + +import * as foo from './0' with { 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 + +=== 2.ts === +import { a, b } from './0' with {} +>a : 1 +>b : 2 + +import { a as c, b as d } from './0' with { 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 + +=== 3.ts === +const a = import('./0') +>a : Promise +>import('./0') : Promise +>'./0' : "./0" + +const b = import('./0', { with: { type: "json" } }) +>b : Promise +>import('./0', { with: { type: "json" } }) : Promise +>'./0' : "./0" +>{ with: { type: "json" } } : { with: { type: string; }; } +>with : { type: string; } +>{ type: "json" } : { type: string; } +>type : string +>"json" : "json" + +const c = import('./0', { with: { type: "json", ttype: "typo" } }) +>c : Promise +>import('./0', { with: { type: "json", ttype: "typo" } }) : Promise +>'./0' : "./0" +>{ with: { type: "json", ttype: "typo" } } : { with: { type: string; ttype: string; }; } +>with : { type: string; ttype: string; } +>{ type: "json", ttype: "typo" } : { type: string; ttype: string; } +>type : string +>"json" : "json" +>ttype : string +>"typo" : "typo" + +const d = import('./0', { with: {} }) +>d : Promise +>import('./0', { with: {} }) : Promise +>'./0' : "./0" +>{ with: {} } : { with: {}; } +>with : {} +>{} : {} + +const dd = import('./0', {}) +>dd : Promise +>import('./0', {}) : Promise +>'./0' : "./0" +>{} : {} + +declare function foo(): any; +>foo : () => any + +const e = import('./0', foo()) +>e : Promise +>import('./0', foo()) : Promise +>'./0' : "./0" +>foo() : any +>foo : () => any + +const f = import() +>f : Promise +>import() : Promise + +const g = import('./0', {}, {}) +>g : Promise +>import('./0', {}, {}) : Promise +>'./0' : "./0" +>{} : {} +>{} : {} + +const h = import('./0', { with: { type: "json" }},) +>h : Promise +>import('./0', { with: { type: "json" }},) : Promise +>'./0' : "./0" +>{ with: { type: "json" }} : { with: { type: string; }; } +>with : { type: string; } +>{ type: "json" } : { type: string; } +>type : string +>"json" : "json" + diff --git a/tests/baselines/reference/importAttributes1(module=es2015).errors.txt b/tests/baselines/reference/importAttributes1(module=es2015).errors.txt new file mode 100644 index 0000000000000..0603408ac3b3d --- /dev/null +++ b/tests/baselines/reference/importAttributes1(module=es2015).errors.txt @@ -0,0 +1,75 @@ +1.ts(1,14): error TS2856: Import attributes cannot be used with type-only imports or exports. +1.ts(2,28): error TS2856: Import attributes cannot be used with type-only imports or exports. +1.ts(3,28): error TS2856: Import attributes cannot be used with type-only imports or exports. +2.ts(1,28): error TS2856: Import attributes cannot be used with type-only imports or exports. +2.ts(2,38): error TS2856: Import attributes cannot be used with type-only imports or exports. +3.ts(1,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +3.ts(2,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +3.ts(3,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +3.ts(4,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +3.ts(5,12): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +3.ts(7,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +3.ts(8,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +3.ts(9,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. +3.ts(10,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. + + +==== 0.ts (0 errors) ==== + export const a = 1; + export const b = 2; + +==== 1.ts (3 errors) ==== + import './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + import { a, b } from './0' with { "type": "json" } + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + import * as foo from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + a; + b; + foo.a; + foo.b; +==== 2.ts (2 errors) ==== + import { a, b } from './0' with {} + ~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + a; + b; + c; + d; +==== 3.ts (9 errors) ==== + const a = import('./0') + ~~~~~~~~~~~~~ +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. + const b = import('./0', { with: { type: "json" } }) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. + const c = import('./0', { with: { type: "json", ttype: "typo" } }) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. + const d = import('./0', { with: {} }) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. + const dd = import('./0', {}) + ~~~~~~~~~~~~~~~~~ +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. + declare function foo(): any; + const e = import('./0', foo()) + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. + const f = import() + ~~~~~~~~ +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. + const g = import('./0', {}, {}) + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. + const h = import('./0', { with: { type: "json" }},) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. + \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes1(module=es2015).js b/tests/baselines/reference/importAttributes1(module=es2015).js new file mode 100644 index 0000000000000..6a3d38f34e0d4 --- /dev/null +++ b/tests/baselines/reference/importAttributes1(module=es2015).js @@ -0,0 +1,82 @@ +//// [tests/cases/conformance/importAttributes/importAttributes1.ts] //// + +//// [0.ts] +export const a = 1; +export const b = 2; + +//// [1.ts] +import './0' with { type: "json" } +import { a, b } from './0' with { "type": "json" } +import * as foo from './0' with { type: "json" } +a; +b; +foo.a; +foo.b; +//// [2.ts] +import { a, b } from './0' with {} +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } +a; +b; +c; +d; +//// [3.ts] +const a = import('./0') +const b = import('./0', { with: { type: "json" } }) +const c = import('./0', { with: { type: "json", ttype: "typo" } }) +const d = import('./0', { with: {} }) +const dd = import('./0', {}) +declare function foo(): any; +const e = import('./0', foo()) +const f = import() +const g = import('./0', {}, {}) +const h = import('./0', { with: { type: "json" }},) + + +//// [0.js] +export const a = 1; +export const b = 2; +//// [1.js] +import './0' with { type: "json" }; +import { a, b } from './0' with { "type": "json" }; +import * as foo from './0' with { type: "json" }; +a; +b; +foo.a; +foo.b; +//// [2.js] +import { a, b } from './0' with {}; +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" }; +a; +b; +c; +d; +//// [3.js] +const a = import('./0'); +const b = import('./0', { with: { type: "json" } }); +const c = import('./0', { with: { type: "json", ttype: "typo" } }); +const d = import('./0', { with: {} }); +const dd = import('./0', {}); +const e = import('./0', foo()); +const f = import(); +const g = import('./0', {}, {}); +const h = import('./0', { with: { 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; +declare const b: Promise; +declare const c: Promise; +declare const d: Promise; +declare const dd: Promise; +declare function foo(): any; +declare const e: Promise; +declare const f: Promise; +declare const g: Promise; +declare const h: Promise; diff --git a/tests/baselines/reference/importAttributes1(module=es2015).symbols b/tests/baselines/reference/importAttributes1(module=es2015).symbols new file mode 100644 index 0000000000000..65dc9f66362e7 --- /dev/null +++ b/tests/baselines/reference/importAttributes1(module=es2015).symbols @@ -0,0 +1,105 @@ +//// [tests/cases/conformance/importAttributes/importAttributes1.ts] //// + +=== 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)) + +=== 1.ts === +import './0' with { type: "json" } +import { a, b } from './0' with { "type": "json" } +>a : Symbol(a, Decl(1.ts, 1, 8)) +>b : Symbol(b, Decl(1.ts, 1, 11)) + +import * as foo from './0' with { 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)) + +=== 2.ts === +import { a, b } from './0' with {} +>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' with { 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)) + +=== 3.ts === +const a = import('./0') +>a : Symbol(a, Decl(3.ts, 0, 5)) +>'./0' : Symbol("0", Decl(0.ts, 0, 0)) + +const b = import('./0', { with: { type: "json" } }) +>b : Symbol(b, Decl(3.ts, 1, 5)) +>'./0' : Symbol("0", Decl(0.ts, 0, 0)) +>with : Symbol(with, Decl(3.ts, 1, 25)) +>type : Symbol(type, Decl(3.ts, 1, 33)) + +const c = import('./0', { with: { type: "json", ttype: "typo" } }) +>c : Symbol(c, Decl(3.ts, 2, 5)) +>'./0' : Symbol("0", Decl(0.ts, 0, 0)) +>with : Symbol(with, Decl(3.ts, 2, 25)) +>type : Symbol(type, Decl(3.ts, 2, 33)) +>ttype : Symbol(ttype, Decl(3.ts, 2, 47)) + +const d = import('./0', { with: {} }) +>d : Symbol(d, Decl(3.ts, 3, 5)) +>'./0' : Symbol("0", Decl(0.ts, 0, 0)) +>with : Symbol(with, Decl(3.ts, 3, 25)) + +const dd = import('./0', {}) +>dd : Symbol(dd, Decl(3.ts, 4, 5)) +>'./0' : Symbol("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("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("0", Decl(0.ts, 0, 0)) + +const h = import('./0', { with: { type: "json" }},) +>h : Symbol(h, Decl(3.ts, 9, 5)) +>'./0' : Symbol("0", Decl(0.ts, 0, 0)) +>with : Symbol(with, Decl(3.ts, 9, 25)) +>type : Symbol(type, Decl(3.ts, 9, 33)) + diff --git a/tests/baselines/reference/importAttributes1(module=es2015).types b/tests/baselines/reference/importAttributes1(module=es2015).types new file mode 100644 index 0000000000000..fb1da06ede0e4 --- /dev/null +++ b/tests/baselines/reference/importAttributes1(module=es2015).types @@ -0,0 +1,138 @@ +//// [tests/cases/conformance/importAttributes/importAttributes1.ts] //// + +=== 0.ts === +export const a = 1; +>a : 1 +>1 : 1 + +export const b = 2; +>b : 2 +>2 : 2 + +=== 1.ts === +import './0' with { type: "json" } +>type : any + +import { a, b } from './0' with { "type": "json" } +>a : 1 +>b : 2 + +import * as foo from './0' with { 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 + +=== 2.ts === +import { a, b } from './0' with {} +>a : 1 +>b : 2 + +import { a as c, b as d } from './0' with { 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 + +=== 3.ts === +const a = import('./0') +>a : Promise +>import('./0') : Promise +>'./0' : "./0" + +const b = import('./0', { with: { type: "json" } }) +>b : Promise +>import('./0', { with: { type: "json" } }) : Promise +>'./0' : "./0" +>{ with: { type: "json" } } : { with: { type: string; }; } +>with : { type: string; } +>{ type: "json" } : { type: string; } +>type : string +>"json" : "json" + +const c = import('./0', { with: { type: "json", ttype: "typo" } }) +>c : Promise +>import('./0', { with: { type: "json", ttype: "typo" } }) : Promise +>'./0' : "./0" +>{ with: { type: "json", ttype: "typo" } } : { with: { type: string; ttype: string; }; } +>with : { type: string; ttype: string; } +>{ type: "json", ttype: "typo" } : { type: string; ttype: string; } +>type : string +>"json" : "json" +>ttype : string +>"typo" : "typo" + +const d = import('./0', { with: {} }) +>d : Promise +>import('./0', { with: {} }) : Promise +>'./0' : "./0" +>{ with: {} } : { with: {}; } +>with : {} +>{} : {} + +const dd = import('./0', {}) +>dd : Promise +>import('./0', {}) : Promise +>'./0' : "./0" +>{} : {} + +declare function foo(): any; +>foo : () => any + +const e = import('./0', foo()) +>e : Promise +>import('./0', foo()) : Promise +>'./0' : "./0" +>foo() : any +>foo : () => any + +const f = import() +>f : Promise +>import() : Promise + +const g = import('./0', {}, {}) +>g : Promise +>import('./0', {}, {}) : Promise +>'./0' : "./0" +>{} : {} +>{} : {} + +const h = import('./0', { with: { type: "json" }},) +>h : Promise +>import('./0', { with: { type: "json" }},) : Promise +>'./0' : "./0" +>{ with: { type: "json" }} : { with: { type: string; }; } +>with : { type: string; } +>{ type: "json" } : { type: string; } +>type : string +>"json" : "json" + diff --git a/tests/baselines/reference/importAttributes1(module=esnext).errors.txt b/tests/baselines/reference/importAttributes1(module=esnext).errors.txt new file mode 100644 index 0000000000000..95c52f3bcd235 --- /dev/null +++ b/tests/baselines/reference/importAttributes1(module=esnext).errors.txt @@ -0,0 +1,39 @@ +3.ts(8,11): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments +3.ts(9,11): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments + + +==== 0.ts (0 errors) ==== + export const a = 1; + export const b = 2; + +==== 1.ts (0 errors) ==== + import './0' with { type: "json" } + import { a, b } from './0' with { "type": "json" } + import * as foo from './0' with { type: "json" } + a; + b; + foo.a; + foo.b; +==== 2.ts (0 errors) ==== + import { a, b } from './0' with {} + import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } + a; + b; + c; + d; +==== 3.ts (2 errors) ==== + const a = import('./0') + const b = import('./0', { with: { type: "json" } }) + const c = import('./0', { with: { type: "json", ttype: "typo" } }) + const d = import('./0', { with: {} }) + 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 set of attributes as arguments + const g = import('./0', {}, {}) + ~~~~~~~~~~~~~~~~~~~~~ +!!! message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments + const h = import('./0', { with: { type: "json" }},) + \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes1(module=esnext).js b/tests/baselines/reference/importAttributes1(module=esnext).js new file mode 100644 index 0000000000000..6a3d38f34e0d4 --- /dev/null +++ b/tests/baselines/reference/importAttributes1(module=esnext).js @@ -0,0 +1,82 @@ +//// [tests/cases/conformance/importAttributes/importAttributes1.ts] //// + +//// [0.ts] +export const a = 1; +export const b = 2; + +//// [1.ts] +import './0' with { type: "json" } +import { a, b } from './0' with { "type": "json" } +import * as foo from './0' with { type: "json" } +a; +b; +foo.a; +foo.b; +//// [2.ts] +import { a, b } from './0' with {} +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } +a; +b; +c; +d; +//// [3.ts] +const a = import('./0') +const b = import('./0', { with: { type: "json" } }) +const c = import('./0', { with: { type: "json", ttype: "typo" } }) +const d = import('./0', { with: {} }) +const dd = import('./0', {}) +declare function foo(): any; +const e = import('./0', foo()) +const f = import() +const g = import('./0', {}, {}) +const h = import('./0', { with: { type: "json" }},) + + +//// [0.js] +export const a = 1; +export const b = 2; +//// [1.js] +import './0' with { type: "json" }; +import { a, b } from './0' with { "type": "json" }; +import * as foo from './0' with { type: "json" }; +a; +b; +foo.a; +foo.b; +//// [2.js] +import { a, b } from './0' with {}; +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" }; +a; +b; +c; +d; +//// [3.js] +const a = import('./0'); +const b = import('./0', { with: { type: "json" } }); +const c = import('./0', { with: { type: "json", ttype: "typo" } }); +const d = import('./0', { with: {} }); +const dd = import('./0', {}); +const e = import('./0', foo()); +const f = import(); +const g = import('./0', {}, {}); +const h = import('./0', { with: { 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; +declare const b: Promise; +declare const c: Promise; +declare const d: Promise; +declare const dd: Promise; +declare function foo(): any; +declare const e: Promise; +declare const f: Promise; +declare const g: Promise; +declare const h: Promise; diff --git a/tests/baselines/reference/importAttributes1(module=esnext).symbols b/tests/baselines/reference/importAttributes1(module=esnext).symbols new file mode 100644 index 0000000000000..65dc9f66362e7 --- /dev/null +++ b/tests/baselines/reference/importAttributes1(module=esnext).symbols @@ -0,0 +1,105 @@ +//// [tests/cases/conformance/importAttributes/importAttributes1.ts] //// + +=== 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)) + +=== 1.ts === +import './0' with { type: "json" } +import { a, b } from './0' with { "type": "json" } +>a : Symbol(a, Decl(1.ts, 1, 8)) +>b : Symbol(b, Decl(1.ts, 1, 11)) + +import * as foo from './0' with { 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)) + +=== 2.ts === +import { a, b } from './0' with {} +>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' with { 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)) + +=== 3.ts === +const a = import('./0') +>a : Symbol(a, Decl(3.ts, 0, 5)) +>'./0' : Symbol("0", Decl(0.ts, 0, 0)) + +const b = import('./0', { with: { type: "json" } }) +>b : Symbol(b, Decl(3.ts, 1, 5)) +>'./0' : Symbol("0", Decl(0.ts, 0, 0)) +>with : Symbol(with, Decl(3.ts, 1, 25)) +>type : Symbol(type, Decl(3.ts, 1, 33)) + +const c = import('./0', { with: { type: "json", ttype: "typo" } }) +>c : Symbol(c, Decl(3.ts, 2, 5)) +>'./0' : Symbol("0", Decl(0.ts, 0, 0)) +>with : Symbol(with, Decl(3.ts, 2, 25)) +>type : Symbol(type, Decl(3.ts, 2, 33)) +>ttype : Symbol(ttype, Decl(3.ts, 2, 47)) + +const d = import('./0', { with: {} }) +>d : Symbol(d, Decl(3.ts, 3, 5)) +>'./0' : Symbol("0", Decl(0.ts, 0, 0)) +>with : Symbol(with, Decl(3.ts, 3, 25)) + +const dd = import('./0', {}) +>dd : Symbol(dd, Decl(3.ts, 4, 5)) +>'./0' : Symbol("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("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("0", Decl(0.ts, 0, 0)) + +const h = import('./0', { with: { type: "json" }},) +>h : Symbol(h, Decl(3.ts, 9, 5)) +>'./0' : Symbol("0", Decl(0.ts, 0, 0)) +>with : Symbol(with, Decl(3.ts, 9, 25)) +>type : Symbol(type, Decl(3.ts, 9, 33)) + diff --git a/tests/baselines/reference/importAttributes1(module=esnext).types b/tests/baselines/reference/importAttributes1(module=esnext).types new file mode 100644 index 0000000000000..fb1da06ede0e4 --- /dev/null +++ b/tests/baselines/reference/importAttributes1(module=esnext).types @@ -0,0 +1,138 @@ +//// [tests/cases/conformance/importAttributes/importAttributes1.ts] //// + +=== 0.ts === +export const a = 1; +>a : 1 +>1 : 1 + +export const b = 2; +>b : 2 +>2 : 2 + +=== 1.ts === +import './0' with { type: "json" } +>type : any + +import { a, b } from './0' with { "type": "json" } +>a : 1 +>b : 2 + +import * as foo from './0' with { 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 + +=== 2.ts === +import { a, b } from './0' with {} +>a : 1 +>b : 2 + +import { a as c, b as d } from './0' with { 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 + +=== 3.ts === +const a = import('./0') +>a : Promise +>import('./0') : Promise +>'./0' : "./0" + +const b = import('./0', { with: { type: "json" } }) +>b : Promise +>import('./0', { with: { type: "json" } }) : Promise +>'./0' : "./0" +>{ with: { type: "json" } } : { with: { type: string; }; } +>with : { type: string; } +>{ type: "json" } : { type: string; } +>type : string +>"json" : "json" + +const c = import('./0', { with: { type: "json", ttype: "typo" } }) +>c : Promise +>import('./0', { with: { type: "json", ttype: "typo" } }) : Promise +>'./0' : "./0" +>{ with: { type: "json", ttype: "typo" } } : { with: { type: string; ttype: string; }; } +>with : { type: string; ttype: string; } +>{ type: "json", ttype: "typo" } : { type: string; ttype: string; } +>type : string +>"json" : "json" +>ttype : string +>"typo" : "typo" + +const d = import('./0', { with: {} }) +>d : Promise +>import('./0', { with: {} }) : Promise +>'./0' : "./0" +>{ with: {} } : { with: {}; } +>with : {} +>{} : {} + +const dd = import('./0', {}) +>dd : Promise +>import('./0', {}) : Promise +>'./0' : "./0" +>{} : {} + +declare function foo(): any; +>foo : () => any + +const e = import('./0', foo()) +>e : Promise +>import('./0', foo()) : Promise +>'./0' : "./0" +>foo() : any +>foo : () => any + +const f = import() +>f : Promise +>import() : Promise + +const g = import('./0', {}, {}) +>g : Promise +>import('./0', {}, {}) : Promise +>'./0' : "./0" +>{} : {} +>{} : {} + +const h = import('./0', { with: { type: "json" }},) +>h : Promise +>import('./0', { with: { type: "json" }},) : Promise +>'./0' : "./0" +>{ with: { type: "json" }} : { with: { type: string; }; } +>with : { type: string; } +>{ type: "json" } : { type: string; } +>type : string +>"json" : "json" + diff --git a/tests/baselines/reference/importAttributes2(module=commonjs).errors.txt b/tests/baselines/reference/importAttributes2(module=commonjs).errors.txt new file mode 100644 index 0000000000000..7444a77afec0a --- /dev/null +++ b/tests/baselines/reference/importAttributes2(module=commonjs).errors.txt @@ -0,0 +1,34 @@ +1.ts(1,22): error TS2856: Import attributes cannot be used with type-only imports or exports. +1.ts(2,28): error TS2856: Import attributes cannot be used with type-only imports or exports. +1.ts(3,21): error TS2856: Import attributes cannot be used with type-only imports or exports. +1.ts(4,27): error TS2856: Import attributes cannot be used with type-only imports or exports. +2.ts(1,28): error TS2856: Import attributes cannot be used with type-only imports or exports. +2.ts(2,38): error TS2856: Import attributes cannot be used with type-only imports or exports. + + +==== 0.ts (0 errors) ==== + export const a = 1; + export const b = 2; + +==== 1.ts (4 errors) ==== + export {} from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + export { a, b } from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + export * from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + export * as ns from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + +==== 2.ts (2 errors) ==== + export { a, b } from './0' with {} + ~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes2(module=commonjs).js b/tests/baselines/reference/importAttributes2(module=commonjs).js new file mode 100644 index 0000000000000..98da1bd8edc06 --- /dev/null +++ b/tests/baselines/reference/importAttributes2(module=commonjs).js @@ -0,0 +1,69 @@ +//// [tests/cases/conformance/importAttributes/importAttributes2.ts] //// + +//// [0.ts] +export const a = 1; +export const b = 2; + +//// [1.ts] +export {} from './0' with { type: "json" } +export { a, b } from './0' with { type: "json" } +export * from './0' with { type: "json" } +export * as ns from './0' with { type: "json" } + +//// [2.ts] +export { a, b } from './0' with {} +export { a as c, b as d } from './0' with { 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; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (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'; diff --git a/tests/baselines/reference/importAttributes2(module=commonjs).symbols b/tests/baselines/reference/importAttributes2(module=commonjs).symbols new file mode 100644 index 0000000000000..78ea8b056c56c --- /dev/null +++ b/tests/baselines/reference/importAttributes2(module=commonjs).symbols @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/importAttributes/importAttributes2.ts] //// + +=== 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)) + +=== 1.ts === +export {} from './0' with { type: "json" } +export { a, b } from './0' with { type: "json" } +>a : Symbol(a, Decl(1.ts, 1, 8)) +>b : Symbol(b, Decl(1.ts, 1, 11)) + +export * from './0' with { type: "json" } +export * as ns from './0' with { type: "json" } +>ns : Symbol(ns, Decl(1.ts, 3, 6)) + +=== 2.ts === +export { a, b } from './0' with {} +>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' with { 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)) + diff --git a/tests/baselines/reference/importAttributes2(module=commonjs).types b/tests/baselines/reference/importAttributes2(module=commonjs).types new file mode 100644 index 0000000000000..33f423f35d07d --- /dev/null +++ b/tests/baselines/reference/importAttributes2(module=commonjs).types @@ -0,0 +1,41 @@ +//// [tests/cases/conformance/importAttributes/importAttributes2.ts] //// + +=== 0.ts === +export const a = 1; +>a : 1 +>1 : 1 + +export const b = 2; +>b : 2 +>2 : 2 + +=== 1.ts === +export {} from './0' with { type: "json" } +>type : any + +export { a, b } from './0' with { type: "json" } +>a : 1 +>b : 2 +>type : any + +export * from './0' with { type: "json" } +>type : any + +export * as ns from './0' with { type: "json" } +>ns : typeof import("0") +>type : any + +=== 2.ts === +export { a, b } from './0' with {} +>a : 1 +>b : 2 + +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } +>a : 1 +>c : 1 +>b : 2 +>d : 2 +>a : any +>b : any +>c : any + diff --git a/tests/baselines/reference/importAttributes2(module=es2015).errors.txt b/tests/baselines/reference/importAttributes2(module=es2015).errors.txt new file mode 100644 index 0000000000000..7444a77afec0a --- /dev/null +++ b/tests/baselines/reference/importAttributes2(module=es2015).errors.txt @@ -0,0 +1,34 @@ +1.ts(1,22): error TS2856: Import attributes cannot be used with type-only imports or exports. +1.ts(2,28): error TS2856: Import attributes cannot be used with type-only imports or exports. +1.ts(3,21): error TS2856: Import attributes cannot be used with type-only imports or exports. +1.ts(4,27): error TS2856: Import attributes cannot be used with type-only imports or exports. +2.ts(1,28): error TS2856: Import attributes cannot be used with type-only imports or exports. +2.ts(2,38): error TS2856: Import attributes cannot be used with type-only imports or exports. + + +==== 0.ts (0 errors) ==== + export const a = 1; + export const b = 2; + +==== 1.ts (4 errors) ==== + export {} from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + export { a, b } from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + export * from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + export * as ns from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + +==== 2.ts (2 errors) ==== + export { a, b } from './0' with {} + ~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes2(module=es2015).js b/tests/baselines/reference/importAttributes2(module=es2015).js new file mode 100644 index 0000000000000..b3105648f5715 --- /dev/null +++ b/tests/baselines/reference/importAttributes2(module=es2015).js @@ -0,0 +1,41 @@ +//// [tests/cases/conformance/importAttributes/importAttributes2.ts] //// + +//// [0.ts] +export const a = 1; +export const b = 2; + +//// [1.ts] +export {} from './0' with { type: "json" } +export { a, b } from './0' with { type: "json" } +export * from './0' with { type: "json" } +export * as ns from './0' with { type: "json" } + +//// [2.ts] +export { a, b } from './0' with {} +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } + + +//// [0.js] +export const a = 1; +export const b = 2; +//// [1.js] +export { a, b } from './0' with { type: "json" }; +export * from './0' with { type: "json" }; +import * as ns_1 from './0' with { type: "json" }; +export { ns_1 as ns }; +//// [2.js] +export { a, b } from './0' with {}; +export { a as c, b as d } from './0' with { 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'; diff --git a/tests/baselines/reference/importAttributes2(module=es2015).symbols b/tests/baselines/reference/importAttributes2(module=es2015).symbols new file mode 100644 index 0000000000000..78ea8b056c56c --- /dev/null +++ b/tests/baselines/reference/importAttributes2(module=es2015).symbols @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/importAttributes/importAttributes2.ts] //// + +=== 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)) + +=== 1.ts === +export {} from './0' with { type: "json" } +export { a, b } from './0' with { type: "json" } +>a : Symbol(a, Decl(1.ts, 1, 8)) +>b : Symbol(b, Decl(1.ts, 1, 11)) + +export * from './0' with { type: "json" } +export * as ns from './0' with { type: "json" } +>ns : Symbol(ns, Decl(1.ts, 3, 6)) + +=== 2.ts === +export { a, b } from './0' with {} +>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' with { 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)) + diff --git a/tests/baselines/reference/importAttributes2(module=es2015).types b/tests/baselines/reference/importAttributes2(module=es2015).types new file mode 100644 index 0000000000000..33f423f35d07d --- /dev/null +++ b/tests/baselines/reference/importAttributes2(module=es2015).types @@ -0,0 +1,41 @@ +//// [tests/cases/conformance/importAttributes/importAttributes2.ts] //// + +=== 0.ts === +export const a = 1; +>a : 1 +>1 : 1 + +export const b = 2; +>b : 2 +>2 : 2 + +=== 1.ts === +export {} from './0' with { type: "json" } +>type : any + +export { a, b } from './0' with { type: "json" } +>a : 1 +>b : 2 +>type : any + +export * from './0' with { type: "json" } +>type : any + +export * as ns from './0' with { type: "json" } +>ns : typeof import("0") +>type : any + +=== 2.ts === +export { a, b } from './0' with {} +>a : 1 +>b : 2 + +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } +>a : 1 +>c : 1 +>b : 2 +>d : 2 +>a : any +>b : any +>c : any + diff --git a/tests/baselines/reference/importAttributes2(module=esnext).js b/tests/baselines/reference/importAttributes2(module=esnext).js new file mode 100644 index 0000000000000..954e66a8db191 --- /dev/null +++ b/tests/baselines/reference/importAttributes2(module=esnext).js @@ -0,0 +1,40 @@ +//// [tests/cases/conformance/importAttributes/importAttributes2.ts] //// + +//// [0.ts] +export const a = 1; +export const b = 2; + +//// [1.ts] +export {} from './0' with { type: "json" } +export { a, b } from './0' with { type: "json" } +export * from './0' with { type: "json" } +export * as ns from './0' with { type: "json" } + +//// [2.ts] +export { a, b } from './0' with {} +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } + + +//// [0.js] +export const a = 1; +export const b = 2; +//// [1.js] +export { a, b } from './0' with { type: "json" }; +export * from './0' with { type: "json" }; +export * as ns from './0' with { type: "json" }; +//// [2.js] +export { a, b } from './0' with {}; +export { a as c, b as d } from './0' with { 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'; diff --git a/tests/baselines/reference/importAttributes2(module=esnext).symbols b/tests/baselines/reference/importAttributes2(module=esnext).symbols new file mode 100644 index 0000000000000..78ea8b056c56c --- /dev/null +++ b/tests/baselines/reference/importAttributes2(module=esnext).symbols @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/importAttributes/importAttributes2.ts] //// + +=== 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)) + +=== 1.ts === +export {} from './0' with { type: "json" } +export { a, b } from './0' with { type: "json" } +>a : Symbol(a, Decl(1.ts, 1, 8)) +>b : Symbol(b, Decl(1.ts, 1, 11)) + +export * from './0' with { type: "json" } +export * as ns from './0' with { type: "json" } +>ns : Symbol(ns, Decl(1.ts, 3, 6)) + +=== 2.ts === +export { a, b } from './0' with {} +>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' with { 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)) + diff --git a/tests/baselines/reference/importAttributes2(module=esnext).types b/tests/baselines/reference/importAttributes2(module=esnext).types new file mode 100644 index 0000000000000..45b7e6e2b47ea --- /dev/null +++ b/tests/baselines/reference/importAttributes2(module=esnext).types @@ -0,0 +1,41 @@ +//// [tests/cases/conformance/importAttributes/importAttributes2.ts] //// + +=== 0.ts === +export const a = 1; +>a : 1 +>1 : 1 + +export const b = 2; +>b : 2 +>2 : 2 + +=== 1.ts === +export {} from './0' with { type: "json" } +>type : error + +export { a, b } from './0' with { type: "json" } +>a : 1 +>b : 2 +>type : error + +export * from './0' with { type: "json" } +>type : error + +export * as ns from './0' with { type: "json" } +>ns : typeof import("0") +>type : error + +=== 2.ts === +export { a, b } from './0' with {} +>a : 1 +>b : 2 + +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } +>a : 1 +>c : 1 +>b : 2 +>d : 2 +>a : error +>b : error +>c : error + diff --git a/tests/baselines/reference/importAttributes3(module=es2015).errors.txt b/tests/baselines/reference/importAttributes3(module=es2015).errors.txt new file mode 100644 index 0000000000000..c85b0aa3ef7e5 --- /dev/null +++ b/tests/baselines/reference/importAttributes3(module=es2015).errors.txt @@ -0,0 +1,25 @@ +1.ts(1,27): error TS2856: Import attributes cannot be used with type-only imports or exports. +1.ts(2,30): error TS2856: Import attributes cannot be used with type-only imports or exports. +2.ts(1,31): error TS2856: Import attributes cannot be used with type-only imports or exports. +2.ts(2,33): error TS2856: Import attributes cannot be used with type-only imports or exports. + + +==== 0.ts (0 errors) ==== + export interface I { } + +==== 1.ts (2 errors) ==== + export type {} from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + export type { I } from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + +==== 2.ts (2 errors) ==== + import type { I } from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + import type * as foo from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes3(module=es2015).js b/tests/baselines/reference/importAttributes3(module=es2015).js new file mode 100644 index 0000000000000..493e570835215 --- /dev/null +++ b/tests/baselines/reference/importAttributes3(module=es2015).js @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/importAttributes/importAttributes3.ts] //// + +//// [0.ts] +export interface I { } + +//// [1.ts] +export type {} from './0' with { type: "json" } +export type { I } from './0' with { type: "json" } + +//// [2.ts] +import type { I } from './0' with { type: "json" } +import type * as foo from './0' with { 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 {}; diff --git a/tests/baselines/reference/importAttributes3(module=es2015).symbols b/tests/baselines/reference/importAttributes3(module=es2015).symbols new file mode 100644 index 0000000000000..92dcfb705744c --- /dev/null +++ b/tests/baselines/reference/importAttributes3(module=es2015).symbols @@ -0,0 +1,18 @@ +//// [tests/cases/conformance/importAttributes/importAttributes3.ts] //// + +=== 0.ts === +export interface I { } +>I : Symbol(I, Decl(0.ts, 0, 0)) + +=== 1.ts === +export type {} from './0' with { type: "json" } +export type { I } from './0' with { type: "json" } +>I : Symbol(I, Decl(1.ts, 1, 13)) + +=== 2.ts === +import type { I } from './0' with { type: "json" } +>I : Symbol(I, Decl(2.ts, 0, 13)) + +import type * as foo from './0' with { type: "json" } +>foo : Symbol(foo, Decl(2.ts, 1, 11)) + diff --git a/tests/baselines/reference/importAttributes3(module=es2015).types b/tests/baselines/reference/importAttributes3(module=es2015).types new file mode 100644 index 0000000000000..c0dc4e66342e5 --- /dev/null +++ b/tests/baselines/reference/importAttributes3(module=es2015).types @@ -0,0 +1,23 @@ +//// [tests/cases/conformance/importAttributes/importAttributes3.ts] //// + +=== 0.ts === + +export interface I { } + +=== 1.ts === +export type {} from './0' with { type: "json" } +>type : any + +export type { I } from './0' with { type: "json" } +>I : import("0").I +>type : any + +=== 2.ts === +import type { I } from './0' with { type: "json" } +>I : I +>type : any + +import type * as foo from './0' with { type: "json" } +>foo : typeof foo +>type : any + diff --git a/tests/baselines/reference/importAttributes3(module=esnext).errors.txt b/tests/baselines/reference/importAttributes3(module=esnext).errors.txt new file mode 100644 index 0000000000000..c85b0aa3ef7e5 --- /dev/null +++ b/tests/baselines/reference/importAttributes3(module=esnext).errors.txt @@ -0,0 +1,25 @@ +1.ts(1,27): error TS2856: Import attributes cannot be used with type-only imports or exports. +1.ts(2,30): error TS2856: Import attributes cannot be used with type-only imports or exports. +2.ts(1,31): error TS2856: Import attributes cannot be used with type-only imports or exports. +2.ts(2,33): error TS2856: Import attributes cannot be used with type-only imports or exports. + + +==== 0.ts (0 errors) ==== + export interface I { } + +==== 1.ts (2 errors) ==== + export type {} from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + export type { I } from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + +==== 2.ts (2 errors) ==== + import type { I } from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + import type * as foo from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes3(module=esnext).js b/tests/baselines/reference/importAttributes3(module=esnext).js new file mode 100644 index 0000000000000..493e570835215 --- /dev/null +++ b/tests/baselines/reference/importAttributes3(module=esnext).js @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/importAttributes/importAttributes3.ts] //// + +//// [0.ts] +export interface I { } + +//// [1.ts] +export type {} from './0' with { type: "json" } +export type { I } from './0' with { type: "json" } + +//// [2.ts] +import type { I } from './0' with { type: "json" } +import type * as foo from './0' with { 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 {}; diff --git a/tests/baselines/reference/importAttributes3(module=esnext).symbols b/tests/baselines/reference/importAttributes3(module=esnext).symbols new file mode 100644 index 0000000000000..92dcfb705744c --- /dev/null +++ b/tests/baselines/reference/importAttributes3(module=esnext).symbols @@ -0,0 +1,18 @@ +//// [tests/cases/conformance/importAttributes/importAttributes3.ts] //// + +=== 0.ts === +export interface I { } +>I : Symbol(I, Decl(0.ts, 0, 0)) + +=== 1.ts === +export type {} from './0' with { type: "json" } +export type { I } from './0' with { type: "json" } +>I : Symbol(I, Decl(1.ts, 1, 13)) + +=== 2.ts === +import type { I } from './0' with { type: "json" } +>I : Symbol(I, Decl(2.ts, 0, 13)) + +import type * as foo from './0' with { type: "json" } +>foo : Symbol(foo, Decl(2.ts, 1, 11)) + diff --git a/tests/baselines/reference/importAttributes3(module=esnext).types b/tests/baselines/reference/importAttributes3(module=esnext).types new file mode 100644 index 0000000000000..c0dc4e66342e5 --- /dev/null +++ b/tests/baselines/reference/importAttributes3(module=esnext).types @@ -0,0 +1,23 @@ +//// [tests/cases/conformance/importAttributes/importAttributes3.ts] //// + +=== 0.ts === + +export interface I { } + +=== 1.ts === +export type {} from './0' with { type: "json" } +>type : any + +export type { I } from './0' with { type: "json" } +>I : import("0").I +>type : any + +=== 2.ts === +import type { I } from './0' with { type: "json" } +>I : I +>type : any + +import type * as foo from './0' with { type: "json" } +>foo : typeof foo +>type : any + diff --git a/tests/baselines/reference/importAttributes4.errors.txt b/tests/baselines/reference/importAttributes4.errors.txt new file mode 100644 index 0000000000000..8a3eb811f4300 --- /dev/null +++ b/tests/baselines/reference/importAttributes4.errors.txt @@ -0,0 +1,10 @@ +importAttributes4.ts(1,20): error TS2307: Cannot find module './first' or its corresponding type declarations. +importAttributes4.ts(1,34): error TS1005: '{' expected. + + +==== importAttributes4.ts (2 errors) ==== + import * as f from "./first" with + ~~~~~~~~~ +!!! error TS2307: Cannot find module './first' or its corresponding type declarations. + +!!! error TS1005: '{' expected. \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes4.js b/tests/baselines/reference/importAttributes4.js new file mode 100644 index 0000000000000..9b84ed6efd16e --- /dev/null +++ b/tests/baselines/reference/importAttributes4.js @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/importAttributes/importAttributes4.ts] //// + +//// [importAttributes4.ts] +import * as f from "./first" with + +//// [importAttributes4.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/importAttributes4.symbols b/tests/baselines/reference/importAttributes4.symbols new file mode 100644 index 0000000000000..786bd1a86ccc6 --- /dev/null +++ b/tests/baselines/reference/importAttributes4.symbols @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/importAttributes/importAttributes4.ts] //// + +=== importAttributes4.ts === +import * as f from "./first" with +>f : Symbol(f, Decl(importAttributes4.ts, 0, 6)) + diff --git a/tests/baselines/reference/importAttributes4.types b/tests/baselines/reference/importAttributes4.types new file mode 100644 index 0000000000000..d95e9509ee362 --- /dev/null +++ b/tests/baselines/reference/importAttributes4.types @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/importAttributes/importAttributes4.ts] //// + +=== importAttributes4.ts === +import * as f from "./first" with +>f : any + diff --git a/tests/baselines/reference/importAttributes5.errors.txt b/tests/baselines/reference/importAttributes5.errors.txt new file mode 100644 index 0000000000000..8ad480f8b033c --- /dev/null +++ b/tests/baselines/reference/importAttributes5.errors.txt @@ -0,0 +1,11 @@ +importAttributes5.ts(1,20): error TS2307: Cannot find module './first' or its corresponding type declarations. +importAttributes5.ts(1,36): error TS1005: '}' expected. + + +==== importAttributes5.ts (2 errors) ==== + import * as f from "./first" with { + ~~~~~~~~~ +!!! error TS2307: Cannot find module './first' or its corresponding type declarations. + +!!! error TS1005: '}' expected. +!!! related TS1007 importAttributes5.ts:1:35: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes5.js b/tests/baselines/reference/importAttributes5.js new file mode 100644 index 0000000000000..959d12d1cb3e6 --- /dev/null +++ b/tests/baselines/reference/importAttributes5.js @@ -0,0 +1,8 @@ +//// [tests/cases/conformance/importAttributes/importAttributes5.ts] //// + +//// [importAttributes5.ts] +import * as f from "./first" with { + +//// [importAttributes5.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/importAttributes5.symbols b/tests/baselines/reference/importAttributes5.symbols new file mode 100644 index 0000000000000..9fbc386805984 --- /dev/null +++ b/tests/baselines/reference/importAttributes5.symbols @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/importAttributes/importAttributes5.ts] //// + +=== importAttributes5.ts === +import * as f from "./first" with { +>f : Symbol(f, Decl(importAttributes5.ts, 0, 6)) + diff --git a/tests/baselines/reference/importAttributes5.types b/tests/baselines/reference/importAttributes5.types new file mode 100644 index 0000000000000..edefbf59c0d88 --- /dev/null +++ b/tests/baselines/reference/importAttributes5.types @@ -0,0 +1,6 @@ +//// [tests/cases/conformance/importAttributes/importAttributes5.ts] //// + +=== importAttributes5.ts === +import * as f from "./first" with { +>f : any + diff --git a/tests/baselines/reference/importAttributes6.errors.txt b/tests/baselines/reference/importAttributes6.errors.txt new file mode 100644 index 0000000000000..161c2152e4fba --- /dev/null +++ b/tests/baselines/reference/importAttributes6.errors.txt @@ -0,0 +1,28 @@ +mod.mts(1,50): error TS2857: Import attribute values must be string literal expressions. +mod.mts(2,50): error TS2857: Import attribute values must be string literal expressions. +mod.mts(3,50): error TS2857: Import attribute values must be string literal expressions. +mod.mts(4,50): error TS2857: Import attribute values must be string literal expressions. +mod.mts(5,50): error TS2857: Import attribute values must be string literal expressions. +mod.mts(6,64): error TS2857: Import attribute values must be string literal expressions. + + +==== mod.mts (6 errors) ==== + import * as thing1 from "./mod.mjs" with {field: 0}; + ~ +!!! error TS2857: Import attribute values must be string literal expressions. + import * as thing2 from "./mod.mjs" with {field: `a`}; + ~~~ +!!! error TS2857: Import attribute values must be string literal expressions. + import * as thing3 from "./mod.mjs" with {field: /a/g}; + ~~~~ +!!! error TS2857: Import attribute values must be string literal expressions. + import * as thing4 from "./mod.mjs" with {field: ["a"]}; + ~~~~~ +!!! error TS2857: Import attribute values must be string literal expressions. + import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; + ~~~~~~~~ +!!! error TS2857: Import attribute values must be string literal expressions. + import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} + ~~~~~~~~~~~~~ +!!! error TS2857: Import attribute values must be string literal expressions. + \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes6.js b/tests/baselines/reference/importAttributes6.js new file mode 100644 index 0000000000000..c1a77d733f01d --- /dev/null +++ b/tests/baselines/reference/importAttributes6.js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/importAttributes/importAttributes6.ts] //// + +//// [mod.mts] +import * as thing1 from "./mod.mjs" with {field: 0}; +import * as thing2 from "./mod.mjs" with {field: `a`}; +import * as thing3 from "./mod.mjs" with {field: /a/g}; +import * as thing4 from "./mod.mjs" with {field: ["a"]}; +import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; +import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} + + +//// [mod.mjs] +export {}; diff --git a/tests/baselines/reference/importAttributes6.symbols b/tests/baselines/reference/importAttributes6.symbols new file mode 100644 index 0000000000000..5c115c20b333d --- /dev/null +++ b/tests/baselines/reference/importAttributes6.symbols @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/importAttributes/importAttributes6.ts] //// + +=== mod.mts === +import * as thing1 from "./mod.mjs" with {field: 0}; +>thing1 : Symbol(thing1, Decl(mod.mts, 0, 6)) + +import * as thing2 from "./mod.mjs" with {field: `a`}; +>thing2 : Symbol(thing2, Decl(mod.mts, 1, 6)) + +import * as thing3 from "./mod.mjs" with {field: /a/g}; +>thing3 : Symbol(thing3, Decl(mod.mts, 2, 6)) + +import * as thing4 from "./mod.mjs" with {field: ["a"]}; +>thing4 : Symbol(thing4, Decl(mod.mts, 3, 6)) + +import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; +>thing5 : Symbol(thing5, Decl(mod.mts, 4, 6)) +>a : Symbol(a, Decl(mod.mts, 4, 50)) + +import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} +>thing6 : Symbol(thing6, Decl(mod.mts, 5, 6)) +>0..toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) +>toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) + diff --git a/tests/baselines/reference/importAttributes6.types b/tests/baselines/reference/importAttributes6.types new file mode 100644 index 0000000000000..c6db109db2e36 --- /dev/null +++ b/tests/baselines/reference/importAttributes6.types @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/importAttributes/importAttributes6.ts] //// + +=== mod.mts === +import * as thing1 from "./mod.mjs" with {field: 0}; +>thing1 : typeof thing1 +>field : any + +import * as thing2 from "./mod.mjs" with {field: `a`}; +>thing2 : typeof thing1 +>field : any + +import * as thing3 from "./mod.mjs" with {field: /a/g}; +>thing3 : typeof thing1 +>field : any +>/a/g : RegExp + +import * as thing4 from "./mod.mjs" with {field: ["a"]}; +>thing4 : typeof thing1 +>field : any +>["a"] : string[] +>"a" : "a" + +import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; +>thing5 : typeof thing1 +>field : any +>{ a: 0 } : { a: number; } +>a : number +>0 : 0 + +import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} +>thing6 : typeof thing1 +>type : any +>field : any +>0..toString() : string +>0..toString : (radix?: number) => string +>0. : 0 +>toString : (radix?: number) => string + diff --git a/tests/baselines/reference/importAttributes7.js b/tests/baselines/reference/importAttributes7.js new file mode 100644 index 0000000000000..08dce9e20bacb --- /dev/null +++ b/tests/baselines/reference/importAttributes7.js @@ -0,0 +1,75 @@ +//// [tests/cases/conformance/importAttributes/importAttributes7.ts] //// + +//// [a.ts] +export default { + a: "a", + b: "b", + 1: "1", +} + +//// [b.ts] +import a from "./a" with { a: "a", "b": "b", 1: "1" }; + +export async function f() { + const a = import("./a", { + with: { a: "a", "b": "b", 1: "1" }, + }); + a; +} + + +//// [a.js] +export default { + a: "a", + b: "b", + 1: "1", +}; +//// [b.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +export function f() { + return __awaiter(this, void 0, void 0, function () { + var a; + return __generator(this, function (_a) { + a = import("./a", { + with: { a: "a", "b": "b", 1: "1" }, + }); + a; + return [2 /*return*/]; + }); + }); +} diff --git a/tests/baselines/reference/importAttributes7.symbols b/tests/baselines/reference/importAttributes7.symbols new file mode 100644 index 0000000000000..31a03bf8f542f --- /dev/null +++ b/tests/baselines/reference/importAttributes7.symbols @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/importAttributes/importAttributes7.ts] //// + +=== /a.ts === +export default { + a: "a", +>a : Symbol(a, Decl(a.ts, 0, 16)) + + b: "b", +>b : Symbol(b, Decl(a.ts, 1, 11)) + + 1: "1", +>1 : Symbol(1, Decl(a.ts, 2, 11)) +} + +=== /b.ts === +import a from "./a" with { a: "a", "b": "b", 1: "1" }; +>a : Symbol(a, Decl(b.ts, 0, 6)) + +export async function f() { +>f : Symbol(f, Decl(b.ts, 0, 54)) + + const a = import("./a", { +>a : Symbol(a, Decl(b.ts, 3, 9)) +>"./a" : Symbol("/a", Decl(a.ts, 0, 0)) + + with: { a: "a", "b": "b", 1: "1" }, +>with : Symbol(with, Decl(b.ts, 3, 29)) +>a : Symbol(a, Decl(b.ts, 4, 15)) +>"b" : Symbol("b", Decl(b.ts, 4, 23)) +>1 : Symbol(1, Decl(b.ts, 4, 33)) + + }); + a; +>a : Symbol(a, Decl(b.ts, 3, 9)) +} + diff --git a/tests/baselines/reference/importAttributes7.types b/tests/baselines/reference/importAttributes7.types new file mode 100644 index 0000000000000..e76a80fc3ff6f --- /dev/null +++ b/tests/baselines/reference/importAttributes7.types @@ -0,0 +1,48 @@ +//// [tests/cases/conformance/importAttributes/importAttributes7.ts] //// + +=== /a.ts === +export default { +>{ a: "a", b: "b", 1: "1",} : { a: string; b: string; 1: string; } + + a: "a", +>a : string +>"a" : "a" + + b: "b", +>b : string +>"b" : "b" + + 1: "1", +>1 : string +>"1" : "1" +} + +=== /b.ts === +import a from "./a" with { a: "a", "b": "b", 1: "1" }; +>a : { a: string; b: string; 1: string; } +>a : error + +export async function f() { +>f : () => Promise + + const a = import("./a", { +>a : Promise +>import("./a", { with: { a: "a", "b": "b", 1: "1" }, }) : Promise +>"./a" : "./a" +>{ with: { a: "a", "b": "b", 1: "1" }, } : { with: { a: string; b: string; 1: string; }; } + + with: { a: "a", "b": "b", 1: "1" }, +>with : { a: string; b: string; 1: string; } +>{ a: "a", "b": "b", 1: "1" } : { a: string; b: string; 1: string; } +>a : string +>"a" : "a" +>"b" : string +>"b" : "b" +>1 : string +>"1" : "1" + + }); + a; +>a : Promise +} + diff --git a/tests/baselines/reference/importAttributes8.js b/tests/baselines/reference/importAttributes8.js new file mode 100644 index 0000000000000..581dbc1712ebf --- /dev/null +++ b/tests/baselines/reference/importAttributes8.js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/importAttributes/importAttributes8.ts] //// + +//// [a.ts] +export default { + a: "a", + b: "b", + 1: "1", +} + +//// [b.ts] +import a from "./a" +with { a: "a", "b": "b", 1: "1" }; // ok + + +//// [a.js] +export default { + a: "a", + b: "b", + 1: "1", +}; +//// [b.js] +export {}; diff --git a/tests/baselines/reference/importAttributes8.symbols b/tests/baselines/reference/importAttributes8.symbols new file mode 100644 index 0000000000000..142b656ea91a0 --- /dev/null +++ b/tests/baselines/reference/importAttributes8.symbols @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/importAttributes/importAttributes8.ts] //// + +=== /a.ts === +export default { + a: "a", +>a : Symbol(a, Decl(a.ts, 0, 16)) + + b: "b", +>b : Symbol(b, Decl(a.ts, 1, 11)) + + 1: "1", +>1 : Symbol(1, Decl(a.ts, 2, 11)) +} + +=== /b.ts === +import a from "./a" +>a : Symbol(a, Decl(b.ts, 0, 6)) + +with { a: "a", "b": "b", 1: "1" }; // ok + diff --git a/tests/baselines/reference/importAttributes8.types b/tests/baselines/reference/importAttributes8.types new file mode 100644 index 0000000000000..430590c957944 --- /dev/null +++ b/tests/baselines/reference/importAttributes8.types @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/importAttributes/importAttributes8.ts] //// + +=== /a.ts === +export default { +>{ a: "a", b: "b", 1: "1",} : { a: string; b: string; 1: string; } + + a: "a", +>a : string +>"a" : "a" + + b: "b", +>b : string +>"b" : "b" + + 1: "1", +>1 : string +>"1" : "1" +} + +=== /b.ts === +import a from "./a" +>a : { a: string; b: string; 1: string; } + +with { a: "a", "b": "b", 1: "1" }; // ok +>a : error + diff --git a/tests/baselines/reference/importAttributesNonstring.errors.txt b/tests/baselines/reference/importAttributesNonstring.errors.txt new file mode 100644 index 0000000000000..875f3f168061b --- /dev/null +++ b/tests/baselines/reference/importAttributesNonstring.errors.txt @@ -0,0 +1,32 @@ +mod.mts(1,50): error TS2857: Import attribute values must be string literal expressions. +mod.mts(3,50): error TS2857: Import attribute values must be string literal expressions. +mod.mts(5,50): error TS2857: Import attribute values must be string literal expressions. +mod.mts(7,50): error TS2857: Import attribute values must be string literal expressions. +mod.mts(9,50): error TS2857: Import attribute values must be string literal expressions. +mod.mts(11,64): error TS2857: Import attribute values must be string literal expressions. + + +==== mod.mts (6 errors) ==== + import * as thing1 from "./mod.mjs" with {field: 0}; + ~ +!!! error TS2857: Import attribute values must be string literal expressions. + + import * as thing2 from "./mod.mjs" with {field: `a`}; + ~~~ +!!! error TS2857: Import attribute values must be string literal expressions. + + import * as thing3 from "./mod.mjs" with {field: /a/g}; + ~~~~ +!!! error TS2857: Import attribute values must be string literal expressions. + + import * as thing4 from "./mod.mjs" with {field: ["a"]}; + ~~~~~ +!!! error TS2857: Import attribute values must be string literal expressions. + + import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; + ~~~~~~~~ +!!! error TS2857: Import attribute values must be string literal expressions. + + import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} + ~~~~~~~~~~~~~ +!!! error TS2857: Import attribute values must be string literal expressions. \ No newline at end of file diff --git a/tests/baselines/reference/importAttributesNonstring.js b/tests/baselines/reference/importAttributesNonstring.js new file mode 100644 index 0000000000000..2685521b2a3ad --- /dev/null +++ b/tests/baselines/reference/importAttributesNonstring.js @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/importAttributesNonstring.ts] //// + +//// [mod.mts] +import * as thing1 from "./mod.mjs" with {field: 0}; + +import * as thing2 from "./mod.mjs" with {field: `a`}; + +import * as thing3 from "./mod.mjs" with {field: /a/g}; + +import * as thing4 from "./mod.mjs" with {field: ["a"]}; + +import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; + +import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} + +//// [mod.mjs] +export {}; diff --git a/tests/baselines/reference/importAttributesNonstring.symbols b/tests/baselines/reference/importAttributesNonstring.symbols new file mode 100644 index 0000000000000..d69ce0675197a --- /dev/null +++ b/tests/baselines/reference/importAttributesNonstring.symbols @@ -0,0 +1,24 @@ +//// [tests/cases/compiler/importAttributesNonstring.ts] //// + +=== mod.mts === +import * as thing1 from "./mod.mjs" with {field: 0}; +>thing1 : Symbol(thing1, Decl(mod.mts, 0, 6)) + +import * as thing2 from "./mod.mjs" with {field: `a`}; +>thing2 : Symbol(thing2, Decl(mod.mts, 2, 6)) + +import * as thing3 from "./mod.mjs" with {field: /a/g}; +>thing3 : Symbol(thing3, Decl(mod.mts, 4, 6)) + +import * as thing4 from "./mod.mjs" with {field: ["a"]}; +>thing4 : Symbol(thing4, Decl(mod.mts, 6, 6)) + +import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; +>thing5 : Symbol(thing5, Decl(mod.mts, 8, 6)) +>a : Symbol(a, Decl(mod.mts, 8, 50)) + +import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} +>thing6 : Symbol(thing6, Decl(mod.mts, 10, 6)) +>0..toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) +>toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) + diff --git a/tests/baselines/reference/importAttributesNonstring.types b/tests/baselines/reference/importAttributesNonstring.types new file mode 100644 index 0000000000000..e8d29b46f6090 --- /dev/null +++ b/tests/baselines/reference/importAttributesNonstring.types @@ -0,0 +1,38 @@ +//// [tests/cases/compiler/importAttributesNonstring.ts] //// + +=== mod.mts === +import * as thing1 from "./mod.mjs" with {field: 0}; +>thing1 : typeof thing1 +>field : any + +import * as thing2 from "./mod.mjs" with {field: `a`}; +>thing2 : typeof thing1 +>field : any + +import * as thing3 from "./mod.mjs" with {field: /a/g}; +>thing3 : typeof thing1 +>field : any +>/a/g : RegExp + +import * as thing4 from "./mod.mjs" with {field: ["a"]}; +>thing4 : typeof thing1 +>field : any +>["a"] : string[] +>"a" : "a" + +import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; +>thing5 : typeof thing1 +>field : any +>{ a: 0 } : { a: number; } +>a : number +>0 : 0 + +import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} +>thing6 : typeof thing1 +>type : any +>field : any +>0..toString() : string +>0..toString : (radix?: number) => string +>0. : 0 +>toString : (radix?: number) => string + diff --git a/tests/baselines/reference/importCallExpressionGrammarError.errors.txt b/tests/baselines/reference/importCallExpressionGrammarError.errors.txt index 9c5f2c60daed7..a79891a2fc65a 100644 --- a/tests/baselines/reference/importCallExpressionGrammarError.errors.txt +++ b/tests/baselines/reference/importCallExpressionGrammarError.errors.txt @@ -1,6 +1,6 @@ importCallExpressionGrammarError.ts(5,8): error TS1325: Argument of dynamic import cannot be spread element. importCallExpressionGrammarError.ts(7,17): error TS1325: Argument of dynamic import cannot be spread element. -importCallExpressionGrammarError.ts(8,12): message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments +importCallExpressionGrammarError.ts(8,12): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments importCallExpressionGrammarError.ts(9,19): error TS2307: Cannot find module 'pathToModule' or its corresponding type declarations. importCallExpressionGrammarError.ts(9,35): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. importCallExpressionGrammarError.ts(9,35): error TS2559: Type '"secondModule"' has no properties in common with type 'ImportCallOptions'. @@ -20,7 +20,7 @@ importCallExpressionGrammarError.ts(9,35): error TS2559: Type '"secondModule"' h !!! error TS1325: Argument of dynamic import cannot be spread element. const p2 = import(); ~~~~~~~~ -!!! message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments +!!! message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments const p4 = import("pathToModule", "secondModule"); ~~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'pathToModule' or its corresponding type declarations. diff --git a/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.js b/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.js index 6ea138c379ffc..fd213e286ea8f 100644 --- a/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.js +++ b/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.js @@ -157,8 +157,8 @@ export declare const e: typeof import("inner/mjs"); export declare const a: Promise<{ default: typeof import("./index.cjs"); }>; -export declare const b: Promise; -export declare const c: Promise; +export declare const b: Promise; +export declare const c: Promise; export declare const f: Promise<{ default: typeof import("inner"); cjsMain: true; @@ -168,4 +168,4 @@ export declare const d: Promise<{ default: typeof import("inner/cjs"); cjsNonmain: true; }>; -export declare const e: Promise; +export declare const e: Promise; diff --git a/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.types b/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.types index d04a2d2d7bcda..b7d8e6f8690f2 100644 --- a/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.types +++ b/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.types @@ -100,13 +100,13 @@ export const a = import("package/cjs"); >"package/cjs" : "package/cjs" export const b = import("package/mjs"); ->b : Promise ->import("package/mjs") : Promise +>b : Promise +>import("package/mjs") : Promise >"package/mjs" : "package/mjs" export const c = import("package"); ->c : Promise ->import("package") : Promise +>c : Promise +>import("package") : Promise >"package" : "package" export const f = import("inner"); @@ -122,8 +122,8 @@ export const d = import("inner/cjs"); >"inner/cjs" : "inner/cjs" export const e = import("inner/mjs"); ->e : Promise ->import("inner/mjs") : Promise +>e : Promise +>import("inner/mjs") : Promise >"inner/mjs" : "inner/mjs" === node_modules/inner/index.d.ts === diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributes(module=node16).errors.txt new file mode 100644 index 0000000000000..f5703ff09d5fc --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=node16).errors.txt @@ -0,0 +1,25 @@ +error TS2468: Cannot find global value 'Promise'. +index.ts(1,35): error TS2856: Import attributes cannot be used with type-only imports or exports. +otherc.cts(1,35): error TS2856: Import attributes cannot be used with type-only imports or exports. +otherc.cts(2,15): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + + +!!! error TS2468: Cannot find global value 'Promise'. +==== index.ts (1 errors) ==== + import json from "./package.json" with { type: "json" }; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +==== otherc.cts (2 errors) ==== + import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + const json2 = import("./package.json", { with: { type: "json" } }); // should be fine + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +==== package.json (0 errors) ==== + { + "name": "pkg", + "private": true, + "type": "module" + } + \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=node16).js b/tests/baselines/reference/nodeModulesImportAttributes(module=node16).js new file mode 100644 index 0000000000000..608fa65d70951 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=node16).js @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributes.ts] //// + +//// [index.ts] +import json from "./package.json" with { type: "json" }; +//// [otherc.cts] +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine +//// [package.json] +{ + "name": "pkg", + "private": true, + "type": "module" +} + + +//// [index.js] +export {}; +//// [otherc.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var json2 = import("./package.json", { with: { type: "json" } }); // should be fine diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=node16).symbols b/tests/baselines/reference/nodeModulesImportAttributes(module=node16).symbols new file mode 100644 index 0000000000000..6666db3e5b459 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=node16).symbols @@ -0,0 +1,28 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributes.ts] //// + +=== index.ts === +import json from "./package.json" with { type: "json" }; +>json : Symbol(json, Decl(index.ts, 0, 6)) + +=== otherc.cts === +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes +>json : Symbol(json, Decl(otherc.cts, 0, 6)) + +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine +>json2 : Symbol(json2, Decl(otherc.cts, 1, 5)) +>"./package.json" : Symbol("package", Decl(package.json, 0, 0)) +>with : Symbol(with, Decl(otherc.cts, 1, 40)) +>type : Symbol(type, Decl(otherc.cts, 1, 48)) + +=== package.json === +{ + "name": "pkg", +>"name" : Symbol("name", Decl(package.json, 0, 1)) + + "private": true, +>"private" : Symbol("private", Decl(package.json, 1, 18)) + + "type": "module" +>"type" : Symbol("type", Decl(package.json, 2, 20)) +} + diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=node16).types b/tests/baselines/reference/nodeModulesImportAttributes(module=node16).types new file mode 100644 index 0000000000000..a6b4943e6debe --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=node16).types @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributes.ts] //// + +=== index.ts === +import json from "./package.json" with { type: "json" }; +>json : { name: string; private: boolean; type: string; } +>type : any + +=== otherc.cts === +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes +>json : { name: string; private: boolean; type: string; } +>type : any + +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine +>json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> +>import("./package.json", { with: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> +>"./package.json" : "./package.json" +>{ with: { type: "json" } } : { with: { type: string; }; } +>with : { type: string; } +>{ type: "json" } : { type: string; } +>type : string +>"json" : "json" + +=== package.json === +{ +>{ "name": "pkg", "private": true, "type": "module"} : { name: string; private: boolean; type: string; } + + "name": "pkg", +>"name" : string +>"pkg" : "pkg" + + "private": true, +>"private" : boolean +>true : true + + "type": "module" +>"type" : string +>"module" : "module" +} + diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportAttributes(module=nodenext).errors.txt new file mode 100644 index 0000000000000..486245ddb7fde --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=nodenext).errors.txt @@ -0,0 +1,22 @@ +error TS2468: Cannot find global value 'Promise'. +otherc.cts(1,35): error TS2855: Import attributes are not allowed on statements that transpile to CommonJS 'require' calls. +otherc.cts(2,15): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + + +!!! error TS2468: Cannot find global value 'Promise'. +==== index.ts (0 errors) ==== + import json from "./package.json" with { type: "json" }; +==== otherc.cts (2 errors) ==== + import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2855: Import attributes are not allowed on statements that transpile to CommonJS 'require' calls. + const json2 = import("./package.json", { with: { type: "json" } }); // should be fine + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +==== package.json (0 errors) ==== + { + "name": "pkg", + "private": true, + "type": "module" + } + \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=nodenext).js b/tests/baselines/reference/nodeModulesImportAttributes(module=nodenext).js new file mode 100644 index 0000000000000..608fa65d70951 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=nodenext).js @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributes.ts] //// + +//// [index.ts] +import json from "./package.json" with { type: "json" }; +//// [otherc.cts] +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine +//// [package.json] +{ + "name": "pkg", + "private": true, + "type": "module" +} + + +//// [index.js] +export {}; +//// [otherc.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var json2 = import("./package.json", { with: { type: "json" } }); // should be fine diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportAttributes(module=nodenext).symbols new file mode 100644 index 0000000000000..6666db3e5b459 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=nodenext).symbols @@ -0,0 +1,28 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributes.ts] //// + +=== index.ts === +import json from "./package.json" with { type: "json" }; +>json : Symbol(json, Decl(index.ts, 0, 6)) + +=== otherc.cts === +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes +>json : Symbol(json, Decl(otherc.cts, 0, 6)) + +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine +>json2 : Symbol(json2, Decl(otherc.cts, 1, 5)) +>"./package.json" : Symbol("package", Decl(package.json, 0, 0)) +>with : Symbol(with, Decl(otherc.cts, 1, 40)) +>type : Symbol(type, Decl(otherc.cts, 1, 48)) + +=== package.json === +{ + "name": "pkg", +>"name" : Symbol("name", Decl(package.json, 0, 1)) + + "private": true, +>"private" : Symbol("private", Decl(package.json, 1, 18)) + + "type": "module" +>"type" : Symbol("type", Decl(package.json, 2, 20)) +} + diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=nodenext).types b/tests/baselines/reference/nodeModulesImportAttributes(module=nodenext).types new file mode 100644 index 0000000000000..a6b4943e6debe --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=nodenext).types @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributes.ts] //// + +=== index.ts === +import json from "./package.json" with { type: "json" }; +>json : { name: string; private: boolean; type: string; } +>type : any + +=== otherc.cts === +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes +>json : { name: string; private: boolean; type: string; } +>type : any + +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine +>json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> +>import("./package.json", { with: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> +>"./package.json" : "./package.json" +>{ with: { type: "json" } } : { with: { type: string; }; } +>with : { type: string; } +>{ type: "json" } : { type: string; } +>type : string +>"json" : "json" + +=== package.json === +{ +>{ "name": "pkg", "private": true, "type": "module"} : { name: string; private: boolean; type: string; } + + "name": "pkg", +>"name" : string +>"pkg" : "pkg" + + "private": true, +>"private" : boolean +>true : true + + "type": "module" +>"type" : string +>"module" : "module" +} + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt new file mode 100644 index 0000000000000..baa2d3262c1c5 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt @@ -0,0 +1,43 @@ +/index.ts(2,15): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. +/index.ts(6,50): error TS2856: Import attributes cannot be used with type-only imports or exports. +/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. +/index.ts(7,49): error TS2856: Import attributes cannot be used with type-only imports or exports. +/index.ts(11,15): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + + +==== /index.ts (5 errors) ==== + import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + + export interface LocalInterface extends RequireInterface, ImportInterface {} + + import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + export interface Loc extends Req, Imp {} + + export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).js b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).js new file mode 100644 index 0000000000000..7175dbf9479d7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).js @@ -0,0 +1,45 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} +//// [require.d.ts] +export interface RequireInterface {} +//// [index.ts] +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [index.d.ts] +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} +import { type RequireInterface as Req } from "pkg" with { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" with { "resolution-mode": "import" }; +export interface Loc extends Req, Imp { +} +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).symbols b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).symbols new file mode 100644 index 0000000000000..0a1e523577f41 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).symbols @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) + +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) + +export interface LocalInterface extends RequireInterface, ImportInterface {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 80)) +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) +>Req : Symbol(Req, Decl(index.ts, 5, 8)) + +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +>Imp : Symbol(Imp, Decl(index.ts, 6, 8)) + +export interface Loc extends Req, Imp {} +>Loc : Symbol(Loc, Decl(index.ts, 6, 85)) +>Req : Symbol(Req, Decl(index.ts, 5, 8)) +>Imp : Symbol(Imp, Decl(index.ts, 6, 8)) + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 9, 13)) + +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) + +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).types b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).types new file mode 100644 index 0000000000000..26bf48ea1dcd7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).types @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : RequireInterface + +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : any + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : any +>Req : any + +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : any +>Imp : any + +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : RequireInterface + +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : any + +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).errors.txt new file mode 100644 index 0000000000000..ee68f3f155a82 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).errors.txt @@ -0,0 +1,43 @@ +/index.ts(2,15): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. +/index.ts(6,50): error TS2855: Import attributes are not allowed on statements that transpile to CommonJS 'require' calls. +/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. +/index.ts(7,49): error TS2855: Import attributes are not allowed on statements that transpile to CommonJS 'require' calls. +/index.ts(11,15): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + + +==== /index.ts (5 errors) ==== + import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + + export interface LocalInterface extends RequireInterface, ImportInterface {} + + import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2855: Import attributes are not allowed on statements that transpile to CommonJS 'require' calls. + import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2855: Import attributes are not allowed on statements that transpile to CommonJS 'require' calls. + export interface Loc extends Req, Imp {} + + export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).js b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).js new file mode 100644 index 0000000000000..7175dbf9479d7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).js @@ -0,0 +1,45 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} +//// [require.d.ts] +export interface RequireInterface {} +//// [index.ts] +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [index.d.ts] +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} +import { type RequireInterface as Req } from "pkg" with { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" with { "resolution-mode": "import" }; +export interface Loc extends Req, Imp { +} +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).symbols new file mode 100644 index 0000000000000..0a1e523577f41 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).symbols @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) + +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) + +export interface LocalInterface extends RequireInterface, ImportInterface {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 80)) +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) +>Req : Symbol(Req, Decl(index.ts, 5, 8)) + +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +>Imp : Symbol(Imp, Decl(index.ts, 6, 8)) + +export interface Loc extends Req, Imp {} +>Loc : Symbol(Loc, Decl(index.ts, 6, 85)) +>Req : Symbol(Req, Decl(index.ts, 5, 8)) +>Imp : Symbol(Imp, Decl(index.ts, 6, 8)) + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 9, 13)) + +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) + +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).types b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).types new file mode 100644 index 0000000000000..26bf48ea1dcd7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).types @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : RequireInterface + +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : any + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : any +>Req : any + +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : any +>Imp : any + +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : RequireInterface + +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : any + +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt new file mode 100644 index 0000000000000..61879a8cf5146 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt @@ -0,0 +1,48 @@ +/index.ts(1,15): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. +/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. +/index.ts(6,50): error TS2856: Import attributes cannot be used with type-only imports or exports. +/index.ts(7,49): error TS2856: Import attributes cannot be used with type-only imports or exports. +/index.ts(10,15): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. + + +==== /index.ts (5 errors) ==== + import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. + import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + + export interface LocalInterface extends RequireInterface, ImportInterface {} + + import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + export interface Loc extends Req, Imp {} + + export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. + export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} +==== /package.json (0 errors) ==== + { + "private": true, + "type": "module" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).js b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).js new file mode 100644 index 0000000000000..afe399f85b0ad --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).js @@ -0,0 +1,49 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} +//// [require.d.ts] +export interface RequireInterface {} +//// [package.json] +{ + "private": true, + "type": "module" +} +//// [index.ts] +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + + +//// [index.js] +export {}; + + +//// [index.d.ts] +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} +import { type RequireInterface as Req } from "pkg" with { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" with { "resolution-mode": "import" }; +export interface Loc extends Req, Imp { +} +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).symbols b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).symbols new file mode 100644 index 0000000000000..d9714ec8de18c --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).symbols @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) + +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) + +export interface LocalInterface extends RequireInterface, ImportInterface {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 80)) +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +>Req : Symbol(Req, Decl(index.ts, 5, 8)) + +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) +>Imp : Symbol(Imp, Decl(index.ts, 6, 8)) + +export interface Loc extends Req, Imp {} +>Loc : Symbol(Loc, Decl(index.ts, 6, 85)) +>Req : Symbol(Req, Decl(index.ts, 5, 8)) +>Imp : Symbol(Imp, Decl(index.ts, 6, 8)) + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 9, 13)) + +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) + +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).types b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).types new file mode 100644 index 0000000000000..7d22514ed32cf --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).types @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : any + +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : ImportInterface + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : any +>Req : any + +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : any +>Imp : any + +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : any + +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : ImportInterface + +=== /node_modules/pkg/import.d.ts === + +export interface ImportInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt new file mode 100644 index 0000000000000..4af71d98910e3 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt @@ -0,0 +1,48 @@ +/index.ts(1,15): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. +/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. +/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(10,15): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. + + +==== /index.ts (5 errors) ==== + import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. + import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + + export interface LocalInterface extends RequireInterface, ImportInterface {} + + import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1454: `resolution-mode` can only be set for type-only imports. + import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1454: `resolution-mode` can only be set for type-only imports. + export interface Loc extends Req, Imp {} + + export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. + export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} +==== /package.json (0 errors) ==== + { + "private": true, + "type": "module" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).js b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).js new file mode 100644 index 0000000000000..afe399f85b0ad --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).js @@ -0,0 +1,49 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} +//// [require.d.ts] +export interface RequireInterface {} +//// [package.json] +{ + "private": true, + "type": "module" +} +//// [index.ts] +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + + +//// [index.js] +export {}; + + +//// [index.d.ts] +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} +import { type RequireInterface as Req } from "pkg" with { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" with { "resolution-mode": "import" }; +export interface Loc extends Req, Imp { +} +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).symbols new file mode 100644 index 0000000000000..d9714ec8de18c --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).symbols @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) + +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) + +export interface LocalInterface extends RequireInterface, ImportInterface {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 80)) +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +>Req : Symbol(Req, Decl(index.ts, 5, 8)) + +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) +>Imp : Symbol(Imp, Decl(index.ts, 6, 8)) + +export interface Loc extends Req, Imp {} +>Loc : Symbol(Loc, Decl(index.ts, 6, 85)) +>Req : Symbol(Req, Decl(index.ts, 5, 8)) +>Imp : Symbol(Imp, Decl(index.ts, 6, 8)) + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 9, 13)) + +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) + +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).types b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).types new file mode 100644 index 0000000000000..7d22514ed32cf --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).types @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts] //// + +=== /index.ts === +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : any + +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : ImportInterface + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : any +>Req : any + +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : any +>Imp : any + +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : any + +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : ImportInterface + +=== /node_modules/pkg/import.d.ts === + +export interface ImportInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt new file mode 100644 index 0000000000000..7d00b1daae965 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt @@ -0,0 +1,43 @@ +/index.ts(2,45): error TS2856: Import attributes cannot be used with type-only imports or exports. +/index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. +/index.ts(4,39): error TS2856: Import attributes cannot be used with type-only imports or exports. +/index.ts(6,76): error TS2856: Import attributes cannot be used with type-only imports or exports. + + +==== /index.ts (5 errors) ==== + // incorrect mode + import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + ~~~~~~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. + // not type-only + import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + // not exclusively type-only + import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes cannot be used with type-only imports or exports. + + export interface LocalInterface extends RequireInterface, ImportInterface {} + + + + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).js b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).js new file mode 100644 index 0000000000000..988072b042c93 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).js @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} +//// [require.d.ts] +export interface RequireInterface {} +//// [index.ts] +// incorrect mode +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; +// not type-only +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +// not exclusively type-only +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; + +export interface LocalInterface extends RequireInterface, ImportInterface {} + + + + + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [index.d.ts] +import type { RequireInterface } from "pkg"; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).symbols b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).symbols new file mode 100644 index 0000000000000..33a5f17944412 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).symbols @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts] //// + +=== /index.ts === +// incorrect mode +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) + +// not type-only +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) + +// not exclusively type-only +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) +>Req : Symbol(Req, Decl(index.ts, 5, 8)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) +>Req2 : Symbol(Req2, Decl(index.ts, 5, 37)) + +export interface LocalInterface extends RequireInterface, ImportInterface {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 5, 113)) +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) + + + + +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).types b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).types new file mode 100644 index 0000000000000..4d528b8a63323 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).types @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts] //// + +=== /index.ts === +// incorrect mode +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; +>RequireInterface : RequireInterface + +// not type-only +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : any + +// not exclusively type-only +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : any +>Req : any +>RequireInterface : any +>Req2 : any + +export interface LocalInterface extends RequireInterface, ImportInterface {} + + + + +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).errors.txt new file mode 100644 index 0000000000000..b516f644b0ead --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).errors.txt @@ -0,0 +1,43 @@ +/index.ts(2,45): error TS2855: Import attributes are not allowed on statements that transpile to CommonJS 'require' calls. +/index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. +/index.ts(4,39): error TS2855: Import attributes are not allowed on statements that transpile to CommonJS 'require' calls. +/index.ts(6,76): error TS2855: Import attributes are not allowed on statements that transpile to CommonJS 'require' calls. + + +==== /index.ts (5 errors) ==== + // incorrect mode + import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2855: Import attributes are not allowed on statements that transpile to CommonJS 'require' calls. + ~~~~~~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. + // not type-only + import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2855: Import attributes are not allowed on statements that transpile to CommonJS 'require' calls. + // not exclusively type-only + import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2855: Import attributes are not allowed on statements that transpile to CommonJS 'require' calls. + + export interface LocalInterface extends RequireInterface, ImportInterface {} + + + + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).js b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).js new file mode 100644 index 0000000000000..988072b042c93 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).js @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} +//// [require.d.ts] +export interface RequireInterface {} +//// [index.ts] +// incorrect mode +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; +// not type-only +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +// not exclusively type-only +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; + +export interface LocalInterface extends RequireInterface, ImportInterface {} + + + + + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + + +//// [index.d.ts] +import type { RequireInterface } from "pkg"; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +export interface LocalInterface extends RequireInterface, ImportInterface { +} diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).symbols new file mode 100644 index 0000000000000..33a5f17944412 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).symbols @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts] //// + +=== /index.ts === +// incorrect mode +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) + +// not type-only +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) + +// not exclusively type-only +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) +>Req : Symbol(Req, Decl(index.ts, 5, 8)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) +>Req2 : Symbol(Req2, Decl(index.ts, 5, 37)) + +export interface LocalInterface extends RequireInterface, ImportInterface {} +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 5, 113)) +>RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) +>ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) + + + + +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).types b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).types new file mode 100644 index 0000000000000..4d528b8a63323 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=nodenext).types @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts] //// + +=== /index.ts === +// incorrect mode +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; +>RequireInterface : RequireInterface + +// not type-only +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : any + +// not exclusively type-only +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; +>RequireInterface : any +>Req : any +>RequireInterface : any +>Req2 : any + +export interface LocalInterface extends RequireInterface, ImportInterface {} + + + + +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).errors.txt new file mode 100644 index 0000000000000..65d7adc33432d --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).errors.txt @@ -0,0 +1,29 @@ +/index.ts(3,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(6,89): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + +==== /index.ts (2 errors) ==== + export type LocalInterface = + & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); + export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).js b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).js new file mode 100644 index 0000000000000..7fa057ba55639 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} +//// [require.d.ts] +export interface RequireInterface {} +//// [index.ts] +export type LocalInterface = + & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); + + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +exports.a = null; +exports.b = null; + + +//// [index.d.ts] +export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export declare const a: import("pkg").RequireInterface; +export declare const b: any; diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).symbols b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).symbols new file mode 100644 index 0000000000000..e3b90277a99cf --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).symbols @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts] //// + +=== /index.ts === +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) + + & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); +>a : Symbol(a, Decl(index.ts, 4, 12)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); +>b : Symbol(b, Decl(index.ts, 5, 12)) + +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).types b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).types new file mode 100644 index 0000000000000..a809ebd5fbb37 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).types @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts] //// + +=== /index.ts === +export type LocalInterface = +>LocalInterface : any + + & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); +>a : import("/node_modules/pkg/require").RequireInterface +>(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface +>null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +>null as any : any + +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); +>b : any +>(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : any +>null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : any +>null as any : any + +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).errors.txt new file mode 100644 index 0000000000000..65d7adc33432d --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).errors.txt @@ -0,0 +1,29 @@ +/index.ts(3,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(6,89): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + +==== /index.ts (2 errors) ==== + export type LocalInterface = + & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); + export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).js b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).js new file mode 100644 index 0000000000000..7fa057ba55639 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} +//// [require.d.ts] +export interface RequireInterface {} +//// [index.ts] +export type LocalInterface = + & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); + + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +exports.a = null; +exports.b = null; + + +//// [index.d.ts] +export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export declare const a: import("pkg").RequireInterface; +export declare const b: any; diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).symbols new file mode 100644 index 0000000000000..e3b90277a99cf --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).symbols @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts] //// + +=== /index.ts === +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) + + & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); +>a : Symbol(a, Decl(index.ts, 4, 12)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); +>b : Symbol(b, Decl(index.ts, 5, 12)) + +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).types b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).types new file mode 100644 index 0000000000000..a809ebd5fbb37 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).types @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts] //// + +=== /index.ts === +export type LocalInterface = +>LocalInterface : any + + & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); +>a : import("/node_modules/pkg/require").RequireInterface +>(null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface +>null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +>null as any : any + +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); +>b : any +>(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : any +>null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : any +>null as any : any + +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt new file mode 100644 index 0000000000000..1ca93a8a5144e --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt @@ -0,0 +1,325 @@ +error TS2468: Cannot find global value 'Promise'. +/index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(3,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(5,76): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(6,89): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +/other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other.ts(3,22): error TS1005: 'with' expected. +/other.ts(3,39): error TS1005: ';' expected. +/other.ts(3,50): error TS1128: Declaration or statement expected. +/other.ts(3,51): error TS1128: Declaration or statement expected. +/other.ts(3,52): error TS1128: Declaration or statement expected. +/other.ts(3,53): error TS2304: Cannot find name 'RequireInterface'. +/other.ts(4,7): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +/other.ts(4,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. +/other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other.ts(6,49): error TS1005: 'with' expected. +/other.ts(6,66): error TS1005: ';' expected. +/other.ts(6,77): error TS1128: Declaration or statement expected. +/other.ts(6,78): error TS1128: Declaration or statement expected. +/other.ts(6,79): error TS1128: Declaration or statement expected. +/other.ts(6,80): error TS1434: Unexpected keyword or identifier. +/other.ts(6,80): error TS2304: Cannot find name 'RequireInterface'. +/other.ts(6,96): error TS1128: Declaration or statement expected. +/other.ts(7,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other.ts(7,49): error TS1005: 'with' expected. +/other.ts(7,66): error TS1005: ';' expected. +/other.ts(7,76): error TS1128: Declaration or statement expected. +/other.ts(7,77): error TS1128: Declaration or statement expected. +/other.ts(7,78): error TS1128: Declaration or statement expected. +/other.ts(7,79): error TS1434: Unexpected keyword or identifier. +/other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. +/other.ts(7,94): error TS1128: Declaration or statement expected. +/other2.ts(3,30): error TS1463: `resolution-mode` is the only valid key for type import attributes. +/other2.ts(4,30): error TS1463: `resolution-mode` is the only valid key for type import attributes. +/other2.ts(4,50): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +/other2.ts(6,57): error TS1463: `resolution-mode` is the only valid key for type import attributes. +/other2.ts(7,57): error TS1463: `resolution-mode` is the only valid key for type import attributes. +/other2.ts(7,77): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +/other3.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other3.ts(3,21): error TS1005: '{' expected. +/other3.ts(3,23): error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. +/other3.ts(3,55): error TS1005: ';' expected. +/other3.ts(3,56): error TS1128: Declaration or statement expected. +/other3.ts(3,57): error TS2304: Cannot find name 'RequireInterface'. +/other3.ts(4,7): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +/other3.ts(4,21): error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. +/other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other3.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other3.ts(6,48): error TS1005: '{' expected. +/other3.ts(6,50): error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. +/other3.ts(6,100): error TS1005: ',' expected. +/other3.ts(7,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other3.ts(7,48): error TS1005: '{' expected. +/other3.ts(7,50): error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. +/other3.ts(7,98): error TS1005: ',' expected. +/other4.ts(6,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other4.ts(6,21): error TS1005: '{' expected. +/other4.ts(6,21): error TS2448: Block-scoped variable 'Attribute1' used before its declaration. +/other4.ts(6,31): error TS1128: Declaration or statement expected. +/other4.ts(6,32): error TS1128: Declaration or statement expected. +/other4.ts(6,33): error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. +/other4.ts(7,7): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +/other4.ts(7,21): error TS2448: Block-scoped variable 'Attribute2' used before its declaration. +/other4.ts(7,33): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other4.ts(9,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other4.ts(9,48): error TS1005: '{' expected. +/other4.ts(9,58): error TS1005: ',' expected. +/other4.ts(9,59): error TS1134: Variable declaration expected. +/other4.ts(9,76): error TS1005: ',' expected. +/other4.ts(10,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other4.ts(10,48): error TS1005: '{' expected. +/other4.ts(10,58): error TS1005: ',' expected. +/other4.ts(10,59): error TS1134: Variable declaration expected. +/other4.ts(10,75): error TS1005: ',' expected. +/other5.ts(2,29): error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(3,29): error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(3,35): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +/other5.ts(5,56): error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(6,56): error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(6,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + +!!! error TS2468: Cannot find global value 'Promise'. +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} + +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} + +==== /index.ts (4 errors) ==== + export type LocalInterface = + & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface + ~~~~~~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); + ~~~~~~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. + export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + +==== /other.ts (28 errors) ==== + // missing with: + export type LocalInterface = + & import("pkg", {"resolution-mode": "require"}).RequireInterface + ~~~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~~~~~~~~~~~~~~ +!!! error TS1005: 'with' expected. +!!! related TS1007 /other.ts:3:21: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + & import("pkg", {"resolution-mode": "import"}).ImportInterface; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~ +!!! error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. + ~~~~~~~~~~~~~~~ +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. + + export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); + ~~~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~~~~~~~~~~~~~~ +!!! error TS1005: 'with' expected. +!!! related TS1007 /other.ts:6:48: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + ~ +!!! error TS1128: Declaration or statement expected. + export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); + ~~~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~~~~~~~~~~~~~~ +!!! error TS1005: 'with' expected. +!!! related TS1007 /other.ts:7:48: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'ImportInterface'. + ~ +!!! error TS1128: Declaration or statement expected. + +==== /other2.ts (6 errors) ==== + // wrong attribute key + export type LocalInterface = + & import("pkg", { with: {"bad": "require"} }).RequireInterface + ~~~~~ +!!! error TS1463: `resolution-mode` is the only valid key for type import attributes. + & import("pkg", { with: {"bad": "import"} }).ImportInterface; + ~~~~~ +!!! error TS1463: `resolution-mode` is the only valid key for type import attributes. + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); + ~~~~~ +!!! error TS1463: `resolution-mode` is the only valid key for type import attributes. + export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); + ~~~~~ +!!! error TS1463: `resolution-mode` is the only valid key for type import attributes. + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + +==== /other3.ts (17 errors) ==== + // Array instead of object-y thing + export type LocalInterface = + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other3.ts:3:21: The parser expected to find a '}' to match the '{' token here. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. + ~~~~~~~~~~~~~~~ +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. + + export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other3.ts:6:48: The parser expected to find a '}' to match the '{' token here. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. + ~ +!!! error TS1005: ',' expected. + export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other3.ts:7:48: The parser expected to find a '}' to match the '{' token here. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. + ~ +!!! error TS1005: ',' expected. + +==== /other4.ts (19 errors) ==== + // Indirected attribute objecty-thing - not allowed + type Attribute1 = { with: {"resolution-mode": "require"} }; + type Attribute2 = { with: {"resolution-mode": "import"} }; + + export type LocalInterface = + & import("pkg", Attribute1).RequireInterface + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~~~~~~~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other4.ts:6:21: The parser expected to find a '}' to match the '{' token here. + ~~~~~~~~~~ +!!! error TS2448: Block-scoped variable 'Attribute1' used before its declaration. +!!! related TS2728 /other4.ts:9:48: 'Attribute1' is declared here. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. +!!! related TS2728 /other4.ts:9:60: 'RequireInterface' is declared here. + & import("pkg", Attribute2).ImportInterface; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~ +!!! error TS2448: Block-scoped variable 'Attribute2' used before its declaration. +!!! related TS2728 /other4.ts:10:48: 'Attribute2' is declared here. + ~~~~~~~~~~~~~~~ +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. + + export const a = (null as any as import("pkg", Attribute1).RequireInterface); + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~~~~~~~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other4.ts:9:48: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1134: Variable declaration expected. + ~ +!!! error TS1005: ',' expected. + export const b = (null as any as import("pkg", Attribute2).ImportInterface); + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~~~~~~~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other4.ts:10:48: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1134: Variable declaration expected. + ~ +!!! error TS1005: ',' expected. + +==== /other5.ts (6 errors) ==== + export type LocalInterface = + & import("pkg", { with: {} }).RequireInterface + ~~ +!!! error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. + & import("pkg", { with: {} }).ImportInterface; + ~~ +!!! error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + export const a = (null as any as import("pkg", { with: {} }).RequireInterface); + ~~ +!!! error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. + export const b = (null as any as import("pkg", { with: {} }).ImportInterface); + ~~ +!!! error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).js b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).js new file mode 100644 index 0000000000000..2eca0abaed21b --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).js @@ -0,0 +1,153 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmitErrors.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} + +//// [require.d.ts] +export interface RequireInterface {} + +//// [index.ts] +export type LocalInterface = + & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); + +//// [other.ts] +// missing with: +export type LocalInterface = + & import("pkg", {"resolution-mode": "require"}).RequireInterface + & import("pkg", {"resolution-mode": "import"}).ImportInterface; + +export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); +export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); + +//// [other2.ts] +// wrong attribute key +export type LocalInterface = + & import("pkg", { with: {"bad": "require"} }).RequireInterface + & import("pkg", { with: {"bad": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); +export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); + +//// [other3.ts] +// Array instead of object-y thing +export type LocalInterface = + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface + & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; + +export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); +export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); + +//// [other4.ts] +// Indirected attribute objecty-thing - not allowed +type Attribute1 = { with: {"resolution-mode": "require"} }; +type Attribute2 = { with: {"resolution-mode": "import"} }; + +export type LocalInterface = + & import("pkg", Attribute1).RequireInterface + & import("pkg", Attribute2).ImportInterface; + +export const a = (null as any as import("pkg", Attribute1).RequireInterface); +export const b = (null as any as import("pkg", Attribute2).ImportInterface); + +//// [other5.ts] +export type LocalInterface = + & import("pkg", { with: {} }).RequireInterface + & import("pkg", { with: {} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {} }).RequireInterface); +export const b = (null as any as import("pkg", { with: {} }).ImportInterface); + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +exports.a = null; +exports.b = null; +//// [other.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +"resolution-mode"; +"require"; +RequireInterface + & import("pkg", { "resolution-mode": "import" }).ImportInterface; +exports.a = null; +"resolution-mode"; +"require"; +RequireInterface; +; +exports.b = null; +"resolution-mode"; +"import"; +ImportInterface; +; +//// [other2.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +exports.a = null; +exports.b = null; +//// [other3.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +RequireInterface + & import("pkg", [{ "resolution-mode": "import" }]).ImportInterface; +exports.a = null.RequireInterface; +exports.b = null.ImportInterface; +//// [other4.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ImportInterface = exports.Attribute2 = exports.b = exports.RequireInterface = exports.Attribute1 = exports.a = void 0; +exports.Attribute1; +exports.RequireInterface + & import("pkg", exports.Attribute2).ImportInterface; +exports.a = null; +exports.b = null; +//// [other5.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +exports.a = null; +exports.b = null; + + +//// [index.d.ts] +export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export declare const a: import("pkg").RequireInterface; +export declare const b: any; +//// [other.d.ts] +export type LocalInterface = import("pkg"); +export declare const a: any; +export declare const b: any; +//// [other2.d.ts] +export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export declare const a: import("pkg").RequireInterface; +export declare const b: any; +//// [other3.d.ts] +export type LocalInterface = import("pkg")[{ + "resolution-mode": "require"; +}]; +export declare const a: any; +export declare const b: any; +//// [other4.d.ts] +export type LocalInterface = import("pkg"); +export declare const a: any, Attribute1: any, RequireInterface: any; +export declare const b: any, Attribute2: any, ImportInterface: any; +//// [other5.d.ts] +export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export declare const a: import("pkg").RequireInterface; +export declare const b: any; diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).symbols b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).symbols new file mode 100644 index 0000000000000..90a6afc84dd11 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).symbols @@ -0,0 +1,128 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmitErrors.ts] //// + +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + +=== /index.ts === +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) + + & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); +>a : Symbol(a, Decl(index.ts, 4, 12)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); +>b : Symbol(b, Decl(index.ts, 5, 12)) + +=== /other.ts === +// missing with: +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other.ts, 0, 0)) + + & import("pkg", {"resolution-mode": "require"}).RequireInterface + & import("pkg", {"resolution-mode": "import"}).ImportInterface; +>"pkg" : Symbol("/node_modules/pkg/import", Decl(import.d.ts, 0, 0)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other.ts, 3, 21)) + +export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); +>a : Symbol(a, Decl(other.ts, 5, 12)) + +export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); +>b : Symbol(b, Decl(other.ts, 6, 12)) + +=== /other2.ts === +// wrong attribute key +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other2.ts, 0, 0)) + + & import("pkg", { with: {"bad": "require"} }).RequireInterface +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + + & import("pkg", { with: {"bad": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); +>a : Symbol(a, Decl(other2.ts, 5, 12)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + +export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); +>b : Symbol(b, Decl(other2.ts, 6, 12)) + +=== /other3.ts === +// Array instead of object-y thing +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other3.ts, 0, 0)) + + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface +>"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 2, 23)) + + & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; +>"pkg" : Symbol("/node_modules/pkg/import", Decl(import.d.ts, 0, 0)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 3, 23)) + +export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); +>a : Symbol(a, Decl(other3.ts, 5, 12)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 5, 50)) + +export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); +>b : Symbol(b, Decl(other3.ts, 6, 12)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 6, 50)) + +=== /other4.ts === +// Indirected attribute objecty-thing - not allowed +type Attribute1 = { with: {"resolution-mode": "require"} }; +>Attribute1 : Symbol(Attribute1, Decl(other4.ts, 0, 0), Decl(other4.ts, 8, 46)) +>with : Symbol(with, Decl(other4.ts, 1, 19)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other4.ts, 1, 27)) + +type Attribute2 = { with: {"resolution-mode": "import"} }; +>Attribute2 : Symbol(Attribute2, Decl(other4.ts, 1, 59), Decl(other4.ts, 9, 46)) +>with : Symbol(with, Decl(other4.ts, 2, 19)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other4.ts, 2, 27)) + +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other4.ts, 2, 58)) + + & import("pkg", Attribute1).RequireInterface +>Attribute1 : Symbol(Attribute1, Decl(other4.ts, 8, 46)) +>RequireInterface : Symbol(RequireInterface, Decl(other4.ts, 8, 59)) + + & import("pkg", Attribute2).ImportInterface; +>"pkg" : Symbol("/node_modules/pkg/import", Decl(import.d.ts, 0, 0)) +>Attribute2 : Symbol(Attribute2, Decl(other4.ts, 9, 46)) + +export const a = (null as any as import("pkg", Attribute1).RequireInterface); +>a : Symbol(a, Decl(other4.ts, 8, 12)) +>Attribute1 : Symbol(Attribute1, Decl(other4.ts, 8, 46)) +>RequireInterface : Symbol(RequireInterface, Decl(other4.ts, 8, 59)) + +export const b = (null as any as import("pkg", Attribute2).ImportInterface); +>b : Symbol(b, Decl(other4.ts, 9, 12)) +>Attribute2 : Symbol(Attribute2, Decl(other4.ts, 9, 46)) +>ImportInterface : Symbol(ImportInterface, Decl(other4.ts, 9, 59)) + +=== /other5.ts === +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other5.ts, 0, 0)) + + & import("pkg", { with: {} }).RequireInterface +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + + & import("pkg", { with: {} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {} }).RequireInterface); +>a : Symbol(a, Decl(other5.ts, 4, 12)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + +export const b = (null as any as import("pkg", { with: {} }).ImportInterface); +>b : Symbol(b, Decl(other5.ts, 5, 12)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).types b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).types new file mode 100644 index 0000000000000..8f160430a96c3 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).types @@ -0,0 +1,187 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmitErrors.ts] //// + +=== /node_modules/pkg/import.d.ts === + +export interface ImportInterface {} + +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} + +=== /index.ts === +export type LocalInterface = +>LocalInterface : any + + & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); +>a : import("/node_modules/pkg/require").RequireInterface +>(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface +>null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +>null as any : any + +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); +>b : any +>(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : any +>null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : any +>null as any : any + +=== /other.ts === +// missing with: +export type LocalInterface = +>LocalInterface : any + + & import("pkg", {"resolution-mode": "require"}).RequireInterface +>"resolution-mode" : "resolution-mode" +>"require" : "require" +>RequireInterface & import("pkg", {"resolution-mode": "import"}).ImportInterface : number +>RequireInterface : any + + & import("pkg", {"resolution-mode": "import"}).ImportInterface; +>import("pkg", {"resolution-mode": "import"}).ImportInterface : any +>import("pkg", {"resolution-mode": "import"}) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> +>"pkg" : "pkg" +>{"resolution-mode": "import"} : { "resolution-mode": string; } +>"resolution-mode" : string +>"import" : "import" +>ImportInterface : any + +export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); +>a : any +>(null as any as import("pkg", { : any +>null as any as import("pkg", { : any +>null as any : any +>"resolution-mode" : "resolution-mode" +>"require" : "require" +>RequireInterface : any + +export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); +>b : any +>(null as any as import("pkg", { : any +>null as any as import("pkg", { : any +>null as any : any +>"resolution-mode" : "resolution-mode" +>"import" : "import" +>ImportInterface : any + +=== /other2.ts === +// wrong attribute key +export type LocalInterface = +>LocalInterface : any + + & import("pkg", { with: {"bad": "require"} }).RequireInterface + & import("pkg", { with: {"bad": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); +>a : import("/node_modules/pkg/require").RequireInterface +>(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface +>null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +>null as any : any + +export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); +>b : any +>(null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface) : any +>null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface : any +>null as any : any + +=== /other3.ts === +// Array instead of object-y thing +export type LocalInterface = +>LocalInterface : any + + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface +>"resolution-mode" : "require" +>RequireInterface & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : number +>RequireInterface : any + + & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; +>import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : any +>import("pkg", [ {"resolution-mode": "import"} ]) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> +>"pkg" : "pkg" +>[ {"resolution-mode": "import"} ] : { "resolution-mode": string; }[] +>{"resolution-mode": "import"} : { "resolution-mode": string; } +>"resolution-mode" : string +>"import" : "import" +>ImportInterface : any + +export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); +>a : any +>(null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface : any +>(null as any as import("pkg", [ {"resolution-mode": "require"} ]) : any +>null as any as import("pkg", [ {"resolution-mode": "require"} ] : any +>null as any : any +>"resolution-mode" : "require" +>RequireInterface : any + +export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); +>b : any +>(null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : any +>(null as any as import("pkg", [ {"resolution-mode": "import"} ]) : any +>null as any as import("pkg", [ {"resolution-mode": "import"} ] : any +>null as any : any +>"resolution-mode" : "import" +>ImportInterface : any + +=== /other4.ts === +// Indirected attribute objecty-thing - not allowed +type Attribute1 = { with: {"resolution-mode": "require"} }; +>Attribute1 : { with: { "resolution-mode": "require";}; } +>with : { "resolution-mode": "require"; } +>"resolution-mode" : "require" + +type Attribute2 = { with: {"resolution-mode": "import"} }; +>Attribute2 : { with: { "resolution-mode": "import";}; } +>with : { "resolution-mode": "import"; } +>"resolution-mode" : "import" + +export type LocalInterface = +>LocalInterface : any + + & import("pkg", Attribute1).RequireInterface +>Attribute1 : any +>RequireInterface & import("pkg", Attribute2).ImportInterface : number +>RequireInterface : any + + & import("pkg", Attribute2).ImportInterface; +>import("pkg", Attribute2).ImportInterface : any +>import("pkg", Attribute2) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> +>"pkg" : "pkg" +>Attribute2 : any +>ImportInterface : any + +export const a = (null as any as import("pkg", Attribute1).RequireInterface); +>a : any +>(null as any as import("pkg", : any +>null as any as import("pkg", : any +>null as any : any +>Attribute1 : any +>RequireInterface : any + +export const b = (null as any as import("pkg", Attribute2).ImportInterface); +>b : any +>(null as any as import("pkg", : any +>null as any as import("pkg", : any +>null as any : any +>Attribute2 : any +>ImportInterface : any + +=== /other5.ts === +export type LocalInterface = +>LocalInterface : any + + & import("pkg", { with: {} }).RequireInterface + & import("pkg", { with: {} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {} }).RequireInterface); +>a : import("/node_modules/pkg/require").RequireInterface +>(null as any as import("pkg", { with: {} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface +>null as any as import("pkg", { with: {} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +>null as any : any + +export const b = (null as any as import("pkg", { with: {} }).ImportInterface); +>b : any +>(null as any as import("pkg", { with: {} }).ImportInterface) : any +>null as any as import("pkg", { with: {} }).ImportInterface : any +>null as any : any + diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt new file mode 100644 index 0000000000000..1ca93a8a5144e --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt @@ -0,0 +1,325 @@ +error TS2468: Cannot find global value 'Promise'. +/index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(3,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(5,76): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(6,89): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +/other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other.ts(3,22): error TS1005: 'with' expected. +/other.ts(3,39): error TS1005: ';' expected. +/other.ts(3,50): error TS1128: Declaration or statement expected. +/other.ts(3,51): error TS1128: Declaration or statement expected. +/other.ts(3,52): error TS1128: Declaration or statement expected. +/other.ts(3,53): error TS2304: Cannot find name 'RequireInterface'. +/other.ts(4,7): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +/other.ts(4,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. +/other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other.ts(6,49): error TS1005: 'with' expected. +/other.ts(6,66): error TS1005: ';' expected. +/other.ts(6,77): error TS1128: Declaration or statement expected. +/other.ts(6,78): error TS1128: Declaration or statement expected. +/other.ts(6,79): error TS1128: Declaration or statement expected. +/other.ts(6,80): error TS1434: Unexpected keyword or identifier. +/other.ts(6,80): error TS2304: Cannot find name 'RequireInterface'. +/other.ts(6,96): error TS1128: Declaration or statement expected. +/other.ts(7,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other.ts(7,49): error TS1005: 'with' expected. +/other.ts(7,66): error TS1005: ';' expected. +/other.ts(7,76): error TS1128: Declaration or statement expected. +/other.ts(7,77): error TS1128: Declaration or statement expected. +/other.ts(7,78): error TS1128: Declaration or statement expected. +/other.ts(7,79): error TS1434: Unexpected keyword or identifier. +/other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. +/other.ts(7,94): error TS1128: Declaration or statement expected. +/other2.ts(3,30): error TS1463: `resolution-mode` is the only valid key for type import attributes. +/other2.ts(4,30): error TS1463: `resolution-mode` is the only valid key for type import attributes. +/other2.ts(4,50): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +/other2.ts(6,57): error TS1463: `resolution-mode` is the only valid key for type import attributes. +/other2.ts(7,57): error TS1463: `resolution-mode` is the only valid key for type import attributes. +/other2.ts(7,77): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +/other3.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other3.ts(3,21): error TS1005: '{' expected. +/other3.ts(3,23): error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. +/other3.ts(3,55): error TS1005: ';' expected. +/other3.ts(3,56): error TS1128: Declaration or statement expected. +/other3.ts(3,57): error TS2304: Cannot find name 'RequireInterface'. +/other3.ts(4,7): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +/other3.ts(4,21): error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. +/other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other3.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other3.ts(6,48): error TS1005: '{' expected. +/other3.ts(6,50): error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. +/other3.ts(6,100): error TS1005: ',' expected. +/other3.ts(7,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other3.ts(7,48): error TS1005: '{' expected. +/other3.ts(7,50): error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. +/other3.ts(7,98): error TS1005: ',' expected. +/other4.ts(6,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other4.ts(6,21): error TS1005: '{' expected. +/other4.ts(6,21): error TS2448: Block-scoped variable 'Attribute1' used before its declaration. +/other4.ts(6,31): error TS1128: Declaration or statement expected. +/other4.ts(6,32): error TS1128: Declaration or statement expected. +/other4.ts(6,33): error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. +/other4.ts(7,7): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +/other4.ts(7,21): error TS2448: Block-scoped variable 'Attribute2' used before its declaration. +/other4.ts(7,33): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/other4.ts(9,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other4.ts(9,48): error TS1005: '{' expected. +/other4.ts(9,58): error TS1005: ',' expected. +/other4.ts(9,59): error TS1134: Variable declaration expected. +/other4.ts(9,76): error TS1005: ',' expected. +/other4.ts(10,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/other4.ts(10,48): error TS1005: '{' expected. +/other4.ts(10,58): error TS1005: ',' expected. +/other4.ts(10,59): error TS1134: Variable declaration expected. +/other4.ts(10,75): error TS1005: ',' expected. +/other5.ts(2,29): error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(3,29): error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(3,35): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +/other5.ts(5,56): error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(6,56): error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(6,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + +!!! error TS2468: Cannot find global value 'Promise'. +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} + +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} + +==== /index.ts (4 errors) ==== + export type LocalInterface = + & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface + ~~~~~~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); + ~~~~~~~~ +!!! error TS1453: `resolution-mode` should be either `require` or `import`. + export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + +==== /other.ts (28 errors) ==== + // missing with: + export type LocalInterface = + & import("pkg", {"resolution-mode": "require"}).RequireInterface + ~~~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~~~~~~~~~~~~~~ +!!! error TS1005: 'with' expected. +!!! related TS1007 /other.ts:3:21: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + & import("pkg", {"resolution-mode": "import"}).ImportInterface; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~ +!!! error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. + ~~~~~~~~~~~~~~~ +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. + + export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); + ~~~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~~~~~~~~~~~~~~ +!!! error TS1005: 'with' expected. +!!! related TS1007 /other.ts:6:48: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + ~ +!!! error TS1128: Declaration or statement expected. + export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); + ~~~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~~~~~~~~~~~~~~ +!!! error TS1005: 'with' expected. +!!! related TS1007 /other.ts:7:48: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'ImportInterface'. + ~ +!!! error TS1128: Declaration or statement expected. + +==== /other2.ts (6 errors) ==== + // wrong attribute key + export type LocalInterface = + & import("pkg", { with: {"bad": "require"} }).RequireInterface + ~~~~~ +!!! error TS1463: `resolution-mode` is the only valid key for type import attributes. + & import("pkg", { with: {"bad": "import"} }).ImportInterface; + ~~~~~ +!!! error TS1463: `resolution-mode` is the only valid key for type import attributes. + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); + ~~~~~ +!!! error TS1463: `resolution-mode` is the only valid key for type import attributes. + export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); + ~~~~~ +!!! error TS1463: `resolution-mode` is the only valid key for type import attributes. + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + +==== /other3.ts (17 errors) ==== + // Array instead of object-y thing + export type LocalInterface = + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other3.ts:3:21: The parser expected to find a '}' to match the '{' token here. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. + ~~~~~~~~~~~~~~~ +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. + + export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other3.ts:6:48: The parser expected to find a '}' to match the '{' token here. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2538: Type '{ "resolution-mode": "require"; }' cannot be used as an index type. + ~ +!!! error TS1005: ',' expected. + export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other3.ts:7:48: The parser expected to find a '}' to match the '{' token here. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. + ~ +!!! error TS1005: ',' expected. + +==== /other4.ts (19 errors) ==== + // Indirected attribute objecty-thing - not allowed + type Attribute1 = { with: {"resolution-mode": "require"} }; + type Attribute2 = { with: {"resolution-mode": "import"} }; + + export type LocalInterface = + & import("pkg", Attribute1).RequireInterface + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~~~~~~~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other4.ts:6:21: The parser expected to find a '}' to match the '{' token here. + ~~~~~~~~~~ +!!! error TS2448: Block-scoped variable 'Attribute1' used before its declaration. +!!! related TS2728 /other4.ts:9:48: 'Attribute1' is declared here. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. +!!! related TS2728 /other4.ts:9:60: 'RequireInterface' is declared here. + & import("pkg", Attribute2).ImportInterface; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~ +!!! error TS2448: Block-scoped variable 'Attribute2' used before its declaration. +!!! related TS2728 /other4.ts:10:48: 'Attribute2' is declared here. + ~~~~~~~~~~~~~~~ +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. + + export const a = (null as any as import("pkg", Attribute1).RequireInterface); + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~~~~~~~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other4.ts:9:48: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1134: Variable declaration expected. + ~ +!!! error TS1005: ',' expected. + export const b = (null as any as import("pkg", Attribute2).ImportInterface); + ~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~~~~~~~ +!!! error TS1005: '{' expected. +!!! related TS1007 /other4.ts:10:48: The parser expected to find a '}' to match the '{' token here. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1134: Variable declaration expected. + ~ +!!! error TS1005: ',' expected. + +==== /other5.ts (6 errors) ==== + export type LocalInterface = + & import("pkg", { with: {} }).RequireInterface + ~~ +!!! error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. + & import("pkg", { with: {} }).ImportInterface; + ~~ +!!! error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + export const a = (null as any as import("pkg", { with: {} }).RequireInterface); + ~~ +!!! error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. + export const b = (null as any as import("pkg", { with: {} }).ImportInterface); + ~~ +!!! error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).js b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).js new file mode 100644 index 0000000000000..2eca0abaed21b --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).js @@ -0,0 +1,153 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmitErrors.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +//// [import.d.ts] +export interface ImportInterface {} + +//// [require.d.ts] +export interface RequireInterface {} + +//// [index.ts] +export type LocalInterface = + & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); + +//// [other.ts] +// missing with: +export type LocalInterface = + & import("pkg", {"resolution-mode": "require"}).RequireInterface + & import("pkg", {"resolution-mode": "import"}).ImportInterface; + +export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); +export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); + +//// [other2.ts] +// wrong attribute key +export type LocalInterface = + & import("pkg", { with: {"bad": "require"} }).RequireInterface + & import("pkg", { with: {"bad": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); +export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); + +//// [other3.ts] +// Array instead of object-y thing +export type LocalInterface = + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface + & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; + +export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); +export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); + +//// [other4.ts] +// Indirected attribute objecty-thing - not allowed +type Attribute1 = { with: {"resolution-mode": "require"} }; +type Attribute2 = { with: {"resolution-mode": "import"} }; + +export type LocalInterface = + & import("pkg", Attribute1).RequireInterface + & import("pkg", Attribute2).ImportInterface; + +export const a = (null as any as import("pkg", Attribute1).RequireInterface); +export const b = (null as any as import("pkg", Attribute2).ImportInterface); + +//// [other5.ts] +export type LocalInterface = + & import("pkg", { with: {} }).RequireInterface + & import("pkg", { with: {} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {} }).RequireInterface); +export const b = (null as any as import("pkg", { with: {} }).ImportInterface); + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +exports.a = null; +exports.b = null; +//// [other.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +"resolution-mode"; +"require"; +RequireInterface + & import("pkg", { "resolution-mode": "import" }).ImportInterface; +exports.a = null; +"resolution-mode"; +"require"; +RequireInterface; +; +exports.b = null; +"resolution-mode"; +"import"; +ImportInterface; +; +//// [other2.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +exports.a = null; +exports.b = null; +//// [other3.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +RequireInterface + & import("pkg", [{ "resolution-mode": "import" }]).ImportInterface; +exports.a = null.RequireInterface; +exports.b = null.ImportInterface; +//// [other4.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ImportInterface = exports.Attribute2 = exports.b = exports.RequireInterface = exports.Attribute1 = exports.a = void 0; +exports.Attribute1; +exports.RequireInterface + & import("pkg", exports.Attribute2).ImportInterface; +exports.a = null; +exports.b = null; +//// [other5.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +exports.a = null; +exports.b = null; + + +//// [index.d.ts] +export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export declare const a: import("pkg").RequireInterface; +export declare const b: any; +//// [other.d.ts] +export type LocalInterface = import("pkg"); +export declare const a: any; +export declare const b: any; +//// [other2.d.ts] +export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export declare const a: import("pkg").RequireInterface; +export declare const b: any; +//// [other3.d.ts] +export type LocalInterface = import("pkg")[{ + "resolution-mode": "require"; +}]; +export declare const a: any; +export declare const b: any; +//// [other4.d.ts] +export type LocalInterface = import("pkg"); +export declare const a: any, Attribute1: any, RequireInterface: any; +export declare const b: any, Attribute2: any, ImportInterface: any; +//// [other5.d.ts] +export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export declare const a: import("pkg").RequireInterface; +export declare const b: any; diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).symbols new file mode 100644 index 0000000000000..90a6afc84dd11 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).symbols @@ -0,0 +1,128 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmitErrors.ts] //// + +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + +=== /index.ts === +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) + + & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); +>a : Symbol(a, Decl(index.ts, 4, 12)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); +>b : Symbol(b, Decl(index.ts, 5, 12)) + +=== /other.ts === +// missing with: +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other.ts, 0, 0)) + + & import("pkg", {"resolution-mode": "require"}).RequireInterface + & import("pkg", {"resolution-mode": "import"}).ImportInterface; +>"pkg" : Symbol("/node_modules/pkg/import", Decl(import.d.ts, 0, 0)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other.ts, 3, 21)) + +export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); +>a : Symbol(a, Decl(other.ts, 5, 12)) + +export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); +>b : Symbol(b, Decl(other.ts, 6, 12)) + +=== /other2.ts === +// wrong attribute key +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other2.ts, 0, 0)) + + & import("pkg", { with: {"bad": "require"} }).RequireInterface +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + + & import("pkg", { with: {"bad": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); +>a : Symbol(a, Decl(other2.ts, 5, 12)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + +export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); +>b : Symbol(b, Decl(other2.ts, 6, 12)) + +=== /other3.ts === +// Array instead of object-y thing +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other3.ts, 0, 0)) + + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface +>"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 2, 23)) + + & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; +>"pkg" : Symbol("/node_modules/pkg/import", Decl(import.d.ts, 0, 0)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 3, 23)) + +export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); +>a : Symbol(a, Decl(other3.ts, 5, 12)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 5, 50)) + +export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); +>b : Symbol(b, Decl(other3.ts, 6, 12)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other3.ts, 6, 50)) + +=== /other4.ts === +// Indirected attribute objecty-thing - not allowed +type Attribute1 = { with: {"resolution-mode": "require"} }; +>Attribute1 : Symbol(Attribute1, Decl(other4.ts, 0, 0), Decl(other4.ts, 8, 46)) +>with : Symbol(with, Decl(other4.ts, 1, 19)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other4.ts, 1, 27)) + +type Attribute2 = { with: {"resolution-mode": "import"} }; +>Attribute2 : Symbol(Attribute2, Decl(other4.ts, 1, 59), Decl(other4.ts, 9, 46)) +>with : Symbol(with, Decl(other4.ts, 2, 19)) +>"resolution-mode" : Symbol("resolution-mode", Decl(other4.ts, 2, 27)) + +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other4.ts, 2, 58)) + + & import("pkg", Attribute1).RequireInterface +>Attribute1 : Symbol(Attribute1, Decl(other4.ts, 8, 46)) +>RequireInterface : Symbol(RequireInterface, Decl(other4.ts, 8, 59)) + + & import("pkg", Attribute2).ImportInterface; +>"pkg" : Symbol("/node_modules/pkg/import", Decl(import.d.ts, 0, 0)) +>Attribute2 : Symbol(Attribute2, Decl(other4.ts, 9, 46)) + +export const a = (null as any as import("pkg", Attribute1).RequireInterface); +>a : Symbol(a, Decl(other4.ts, 8, 12)) +>Attribute1 : Symbol(Attribute1, Decl(other4.ts, 8, 46)) +>RequireInterface : Symbol(RequireInterface, Decl(other4.ts, 8, 59)) + +export const b = (null as any as import("pkg", Attribute2).ImportInterface); +>b : Symbol(b, Decl(other4.ts, 9, 12)) +>Attribute2 : Symbol(Attribute2, Decl(other4.ts, 9, 46)) +>ImportInterface : Symbol(ImportInterface, Decl(other4.ts, 9, 59)) + +=== /other5.ts === +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(other5.ts, 0, 0)) + + & import("pkg", { with: {} }).RequireInterface +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + + & import("pkg", { with: {} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {} }).RequireInterface); +>a : Symbol(a, Decl(other5.ts, 4, 12)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + +export const b = (null as any as import("pkg", { with: {} }).ImportInterface); +>b : Symbol(b, Decl(other5.ts, 5, 12)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).types b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).types new file mode 100644 index 0000000000000..8f160430a96c3 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).types @@ -0,0 +1,187 @@ +//// [tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmitErrors.ts] //// + +=== /node_modules/pkg/import.d.ts === + +export interface ImportInterface {} + +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} + +=== /index.ts === +export type LocalInterface = +>LocalInterface : any + + & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); +>a : import("/node_modules/pkg/require").RequireInterface +>(null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface +>null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +>null as any : any + +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); +>b : any +>(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : any +>null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : any +>null as any : any + +=== /other.ts === +// missing with: +export type LocalInterface = +>LocalInterface : any + + & import("pkg", {"resolution-mode": "require"}).RequireInterface +>"resolution-mode" : "resolution-mode" +>"require" : "require" +>RequireInterface & import("pkg", {"resolution-mode": "import"}).ImportInterface : number +>RequireInterface : any + + & import("pkg", {"resolution-mode": "import"}).ImportInterface; +>import("pkg", {"resolution-mode": "import"}).ImportInterface : any +>import("pkg", {"resolution-mode": "import"}) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> +>"pkg" : "pkg" +>{"resolution-mode": "import"} : { "resolution-mode": string; } +>"resolution-mode" : string +>"import" : "import" +>ImportInterface : any + +export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); +>a : any +>(null as any as import("pkg", { : any +>null as any as import("pkg", { : any +>null as any : any +>"resolution-mode" : "resolution-mode" +>"require" : "require" +>RequireInterface : any + +export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); +>b : any +>(null as any as import("pkg", { : any +>null as any as import("pkg", { : any +>null as any : any +>"resolution-mode" : "resolution-mode" +>"import" : "import" +>ImportInterface : any + +=== /other2.ts === +// wrong attribute key +export type LocalInterface = +>LocalInterface : any + + & import("pkg", { with: {"bad": "require"} }).RequireInterface + & import("pkg", { with: {"bad": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); +>a : import("/node_modules/pkg/require").RequireInterface +>(null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface +>null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +>null as any : any + +export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); +>b : any +>(null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface) : any +>null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface : any +>null as any : any + +=== /other3.ts === +// Array instead of object-y thing +export type LocalInterface = +>LocalInterface : any + + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface +>"resolution-mode" : "require" +>RequireInterface & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : number +>RequireInterface : any + + & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; +>import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : any +>import("pkg", [ {"resolution-mode": "import"} ]) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> +>"pkg" : "pkg" +>[ {"resolution-mode": "import"} ] : { "resolution-mode": string; }[] +>{"resolution-mode": "import"} : { "resolution-mode": string; } +>"resolution-mode" : string +>"import" : "import" +>ImportInterface : any + +export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); +>a : any +>(null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface : any +>(null as any as import("pkg", [ {"resolution-mode": "require"} ]) : any +>null as any as import("pkg", [ {"resolution-mode": "require"} ] : any +>null as any : any +>"resolution-mode" : "require" +>RequireInterface : any + +export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); +>b : any +>(null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface : any +>(null as any as import("pkg", [ {"resolution-mode": "import"} ]) : any +>null as any as import("pkg", [ {"resolution-mode": "import"} ] : any +>null as any : any +>"resolution-mode" : "import" +>ImportInterface : any + +=== /other4.ts === +// Indirected attribute objecty-thing - not allowed +type Attribute1 = { with: {"resolution-mode": "require"} }; +>Attribute1 : { with: { "resolution-mode": "require";}; } +>with : { "resolution-mode": "require"; } +>"resolution-mode" : "require" + +type Attribute2 = { with: {"resolution-mode": "import"} }; +>Attribute2 : { with: { "resolution-mode": "import";}; } +>with : { "resolution-mode": "import"; } +>"resolution-mode" : "import" + +export type LocalInterface = +>LocalInterface : any + + & import("pkg", Attribute1).RequireInterface +>Attribute1 : any +>RequireInterface & import("pkg", Attribute2).ImportInterface : number +>RequireInterface : any + + & import("pkg", Attribute2).ImportInterface; +>import("pkg", Attribute2).ImportInterface : any +>import("pkg", Attribute2) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> +>"pkg" : "pkg" +>Attribute2 : any +>ImportInterface : any + +export const a = (null as any as import("pkg", Attribute1).RequireInterface); +>a : any +>(null as any as import("pkg", : any +>null as any as import("pkg", : any +>null as any : any +>Attribute1 : any +>RequireInterface : any + +export const b = (null as any as import("pkg", Attribute2).ImportInterface); +>b : any +>(null as any as import("pkg", : any +>null as any as import("pkg", : any +>null as any : any +>Attribute2 : any +>ImportInterface : any + +=== /other5.ts === +export type LocalInterface = +>LocalInterface : any + + & import("pkg", { with: {} }).RequireInterface + & import("pkg", { with: {} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {} }).RequireInterface); +>a : import("/node_modules/pkg/require").RequireInterface +>(null as any as import("pkg", { with: {} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface +>null as any as import("pkg", { with: {} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +>null as any : any + +export const b = (null as any as import("pkg", { with: {} }).ImportInterface); +>b : any +>(null as any as import("pkg", { with: {} }).ImportInterface) : any +>null as any as import("pkg", { with: {} }).ImportInterface : any +>null as any : any + diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js index 1b444aae0dfb3..972ed5f68fdbb 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js @@ -33,4 +33,32 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; +export declare const b: import("pkg").ImportInterface; + + +//// [DtsFileErrors] + + +out/index.d.ts(3,39): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + +==== out/index.d.ts (1 errors) ==== + export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; + export declare const a: import("pkg").RequireInterface; + export declare const b: import("pkg").ImportInterface; + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js index 1b444aae0dfb3..972ed5f68fdbb 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js @@ -33,4 +33,32 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; +export declare const b: import("pkg").ImportInterface; + + +//// [DtsFileErrors] + + +out/index.d.ts(3,39): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + +==== out/index.d.ts (1 errors) ==== + export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; + export declare const a: import("pkg").RequireInterface; + export declare const b: import("pkg").ImportInterface; + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt index c4c4f758de70d..2909c72239162 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt @@ -2,7 +2,7 @@ error TS2468: Cannot find global value 'Promise'. /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -/other.ts(3,22): error TS1005: 'assert' expected. +/other.ts(3,22): error TS1005: 'with' expected. /other.ts(3,39): error TS1005: ';' expected. /other.ts(3,50): error TS1128: Declaration or statement expected. /other.ts(3,51): error TS1128: Declaration or statement expected. @@ -12,7 +12,7 @@ error TS2468: Cannot find global value 'Promise'. /other.ts(4,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. /other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. /other.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -/other.ts(6,49): error TS1005: 'assert' expected. +/other.ts(6,49): error TS1005: 'with' expected. /other.ts(6,66): error TS1005: ';' expected. /other.ts(6,77): error TS1128: Declaration or statement expected. /other.ts(6,78): error TS1128: Declaration or statement expected. @@ -21,7 +21,7 @@ error TS2468: Cannot find global value 'Promise'. /other.ts(6,80): error TS2304: Cannot find name 'RequireInterface'. /other.ts(6,96): error TS1128: Declaration or statement expected. /other.ts(7,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -/other.ts(7,49): error TS1005: 'assert' expected. +/other.ts(7,49): error TS1005: 'with' expected. /other.ts(7,66): error TS1005: ';' expected. /other.ts(7,76): error TS1128: Declaration or statement expected. /other.ts(7,77): error TS1128: Declaration or statement expected. @@ -111,7 +111,7 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~ !!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~~~~~~~~~~ -!!! error TS1005: 'assert' expected. +!!! error TS1005: 'with' expected. !!! related TS1007 /other.ts:3:21: The parser expected to find a '}' to match the '{' token here. ~ !!! error TS1005: ';' expected. @@ -135,7 +135,7 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~ !!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~~~~~~~~~~ -!!! error TS1005: 'assert' expected. +!!! error TS1005: 'with' expected. !!! related TS1007 /other.ts:6:48: The parser expected to find a '}' to match the '{' token here. ~ !!! error TS1005: ';' expected. @@ -155,7 +155,7 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~ !!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~~~~~~~~~~ -!!! error TS1005: 'assert' expected. +!!! error TS1005: 'with' expected. !!! related TS1007 /other.ts:7:48: The parser expected to find a '}' to match the '{' token here. ~ !!! error TS1005: ';' expected. diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js index 6b34fb98748ad..45a682b5c892e 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js @@ -122,9 +122,9 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; +export declare const b: import("pkg").ImportInterface; //// [other.d.ts] -export type LocalInterface = import("pkg", { assert: {} }); +export type LocalInterface = import("pkg"); export declare const a: any; export declare const b: any; //// [other2.d.ts] @@ -132,13 +132,13 @@ export type LocalInterface = import("pkg", { assert: { "bad": "require" } }).Req export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other3.d.ts] -export type LocalInterface = import("pkg", { assert: {} })[{ +export type LocalInterface = import("pkg")[{ "resolution-mode": "require"; }]; export declare const a: any; export declare const b: any; //// [other4.d.ts] -export type LocalInterface = import("pkg", { assert: {} }); +export type LocalInterface = import("pkg"); export declare const a: any, Asserts1: any, RequireInterface: any; export declare const b: any, Asserts2: any, ImportInterface: any; //// [other5.d.ts] diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt index c4c4f758de70d..2909c72239162 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt @@ -2,7 +2,7 @@ error TS2468: Cannot find global value 'Promise'. /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -/other.ts(3,22): error TS1005: 'assert' expected. +/other.ts(3,22): error TS1005: 'with' expected. /other.ts(3,39): error TS1005: ';' expected. /other.ts(3,50): error TS1128: Declaration or statement expected. /other.ts(3,51): error TS1128: Declaration or statement expected. @@ -12,7 +12,7 @@ error TS2468: Cannot find global value 'Promise'. /other.ts(4,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. /other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. /other.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -/other.ts(6,49): error TS1005: 'assert' expected. +/other.ts(6,49): error TS1005: 'with' expected. /other.ts(6,66): error TS1005: ';' expected. /other.ts(6,77): error TS1128: Declaration or statement expected. /other.ts(6,78): error TS1128: Declaration or statement expected. @@ -21,7 +21,7 @@ error TS2468: Cannot find global value 'Promise'. /other.ts(6,80): error TS2304: Cannot find name 'RequireInterface'. /other.ts(6,96): error TS1128: Declaration or statement expected. /other.ts(7,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -/other.ts(7,49): error TS1005: 'assert' expected. +/other.ts(7,49): error TS1005: 'with' expected. /other.ts(7,66): error TS1005: ';' expected. /other.ts(7,76): error TS1128: Declaration or statement expected. /other.ts(7,77): error TS1128: Declaration or statement expected. @@ -111,7 +111,7 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~ !!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~~~~~~~~~~ -!!! error TS1005: 'assert' expected. +!!! error TS1005: 'with' expected. !!! related TS1007 /other.ts:3:21: The parser expected to find a '}' to match the '{' token here. ~ !!! error TS1005: ';' expected. @@ -135,7 +135,7 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~ !!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~~~~~~~~~~ -!!! error TS1005: 'assert' expected. +!!! error TS1005: 'with' expected. !!! related TS1007 /other.ts:6:48: The parser expected to find a '}' to match the '{' token here. ~ !!! error TS1005: ';' expected. @@ -155,7 +155,7 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~ !!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ~~~~~~~~~~~~~~~~~ -!!! error TS1005: 'assert' expected. +!!! error TS1005: 'with' expected. !!! related TS1007 /other.ts:7:48: The parser expected to find a '}' to match the '{' token here. ~ !!! error TS1005: ';' expected. diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js index 6b34fb98748ad..45a682b5c892e 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js @@ -122,9 +122,9 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; +export declare const b: import("pkg").ImportInterface; //// [other.d.ts] -export type LocalInterface = import("pkg", { assert: {} }); +export type LocalInterface = import("pkg"); export declare const a: any; export declare const b: any; //// [other2.d.ts] @@ -132,13 +132,13 @@ export type LocalInterface = import("pkg", { assert: { "bad": "require" } }).Req export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other3.d.ts] -export type LocalInterface = import("pkg", { assert: {} })[{ +export type LocalInterface = import("pkg")[{ "resolution-mode": "require"; }]; export declare const a: any; export declare const b: any; //// [other4.d.ts] -export type LocalInterface = import("pkg", { assert: {} }); +export type LocalInterface = import("pkg"); export declare const a: any, Asserts1: any, RequireInterface: any; export declare const b: any, Asserts2: any, ImportInterface: any; //// [other5.d.ts] diff --git a/tests/baselines/reference/parseImportAttributesError.errors.txt b/tests/baselines/reference/parseImportAttributesError.errors.txt new file mode 100644 index 0000000000000..97893dec8d6b5 --- /dev/null +++ b/tests/baselines/reference/parseImportAttributesError.errors.txt @@ -0,0 +1,44 @@ +/index.ts(2,34): error TS1005: ':' expected. +/index.ts(3,34): error TS1005: ':' expected. +/index.ts(3,68): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(5,61): error TS1005: ':' expected. +/index.ts(6,61): error TS1005: ':' expected. +/index.ts(6,95): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + +==== /index.ts (6 errors) ==== + export type LocalInterface = + & import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface + ~ +!!! error TS1005: ':' expected. + & import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface; + ~ +!!! error TS1005: ':' expected. + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + export const a = (null as any as import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface); + ~ +!!! error TS1005: ':' expected. + export const b = (null as any as import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface); + ~ +!!! error TS1005: ':' expected. + ~~~~~~~~~~~~~~~ +!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } + +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} + +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} + \ No newline at end of file diff --git a/tests/baselines/reference/parseImportAttributesError.js b/tests/baselines/reference/parseImportAttributesError.js new file mode 100644 index 0000000000000..f5ecf476926ff --- /dev/null +++ b/tests/baselines/reference/parseImportAttributesError.js @@ -0,0 +1,39 @@ +//// [tests/cases/compiler/parseImportAttributesError.ts] //// + +//// [package.json] +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} + +//// [import.d.ts] +export interface ImportInterface {} + +//// [require.d.ts] +export interface RequireInterface {} + +//// [index.ts] +export type LocalInterface = + & import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface + & import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface); +export const b = (null as any as import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface); + + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = exports.a = void 0; +exports.a = null; +exports.b = null; + + +//// [index.d.ts] +export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export declare const a: import("pkg").RequireInterface; +export declare const b: any; diff --git a/tests/baselines/reference/parseImportAttributesError.symbols b/tests/baselines/reference/parseImportAttributesError.symbols new file mode 100644 index 0000000000000..c2510c4f88f69 --- /dev/null +++ b/tests/baselines/reference/parseImportAttributesError.symbols @@ -0,0 +1,22 @@ +//// [tests/cases/compiler/parseImportAttributesError.ts] //// + +=== /index.ts === +export type LocalInterface = +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) + + & import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + + & import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface); +>a : Symbol(a, Decl(index.ts, 4, 12)) +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + +export const b = (null as any as import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface); +>b : Symbol(b, Decl(index.ts, 5, 12)) + +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/parseImportAttributesError.types b/tests/baselines/reference/parseImportAttributesError.types new file mode 100644 index 0000000000000..3c34791903cb1 --- /dev/null +++ b/tests/baselines/reference/parseImportAttributesError.types @@ -0,0 +1,30 @@ +//// [tests/cases/compiler/parseImportAttributesError.ts] //// + +=== /index.ts === +export type LocalInterface = +>LocalInterface : any + + & import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface +> : any + + & import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface; +> : any + +export const a = (null as any as import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface); +>a : import("/node_modules/pkg/require").RequireInterface +>(null as any as import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface +>null as any as import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +>null as any : any +> : any + +export const b = (null as any as import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface); +>b : any +>(null as any as import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface) : any +>null as any as import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface : any +>null as any : any +> : any + +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} + diff --git a/tests/baselines/reference/plainJSGrammarErrors.errors.txt b/tests/baselines/reference/plainJSGrammarErrors.errors.txt index 8b015217e305f..b92bd5df1b8ba 100644 --- a/tests/baselines/reference/plainJSGrammarErrors.errors.txt +++ b/tests/baselines/reference/plainJSGrammarErrors.errors.txt @@ -97,8 +97,8 @@ plainJSGrammarErrors.js(197,1): error TS1105: A 'break' statement can only be us plainJSGrammarErrors.js(198,1): error TS1104: A 'continue' statement can only be used within an enclosing iteration statement. plainJSGrammarErrors.js(201,28): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? plainJSGrammarErrors.js(202,22): error TS17012: 'targe' is not a valid meta-property for keyword 'new'. Did you mean 'target'? -plainJSGrammarErrors.js(203,30): message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments -plainJSGrammarErrors.js(204,30): message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments +plainJSGrammarErrors.js(203,30): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments +plainJSGrammarErrors.js(204,30): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments plainJSGrammarErrors.js(205,36): error TS1325: Argument of dynamic import cannot be spread element. @@ -505,10 +505,10 @@ plainJSGrammarErrors.js(205,36): error TS1325: Argument of dynamic import cannot !!! error TS17012: 'targe' is not a valid meta-property for keyword 'new'. Did you mean 'target'? const nullaryDynamicImport = import() ~~~~~~~~ -!!! message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments +!!! message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments const trinaryDynamicImport = import('1', '2', '3') ~~~~~~~~~~~~~~~~~~~~~ -!!! message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments +!!! message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments const spreadDynamicImport = import(...[]) ~~~~~ !!! error TS1325: Argument of dynamic import cannot be spread element. diff --git a/tests/baselines/reference/tscWatch/moduleResolution/module-resolutions-from-files-with-partially-used-import-attributes.js b/tests/baselines/reference/tscWatch/moduleResolution/module-resolutions-from-files-with-partially-used-import-attributes.js new file mode 100644 index 0000000000000..6516433995b3e --- /dev/null +++ b/tests/baselines/reference/tscWatch/moduleResolution/module-resolutions-from-files-with-partially-used-import-attributes.js @@ -0,0 +1,304 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"moduleResolution":"node16"}} + +//// [/user/username/projects/myproject/index.ts] +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg1" with { "resolution-mode": "require" }; +import {x} from "./a"; + + +//// [/user/username/projects/myproject/a.ts] +export const x = 10; + + +//// [/user/username/projects/myproject/node_modules/pkg/package.json] +{"name":"pkg","version":"0.0.1","exports":{"import":"./import.js","require":"./require.js"}} + +//// [/user/username/projects/myproject/node_modules/pkg/import.d.ts] +export interface ImportInterface {} + +//// [/user/username/projects/myproject/node_modules/pkg/require.d.ts] +export interface RequireInterface {} + +//// [/user/username/projects/myproject/node_modules/pkg1/package.json] +{"name":"pkg1","version":"0.0.1","exports":{"import":"./import.js","require":"./require.js"}} + +//// [/user/username/projects/myproject/node_modules/pkg1/import.d.ts] +export interface ImportInterface {} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --traceResolution +Output:: +>> Screen clear +[12:00:39 AM] Starting compilation in watch mode... + +File '/user/username/projects/myproject/package.json' does not exist. +File '/user/username/projects/package.json' does not exist. +File '/user/username/package.json' does not exist. +File '/user/package.json' does not exist. +File '/package.json' does not exist. +File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +======== Resolving module 'pkg' from '/user/username/projects/myproject/index.ts'. ======== +Explicitly specified module resolution kind: 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +Loading module 'pkg' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +Found 'package.json' at '/user/username/projects/myproject/node_modules/pkg/package.json'. +Entering conditional exports. +Saw non-matching condition 'import'. +Matched 'exports' condition 'require'. +Using 'exports' subpath '.' with target './require.js'. +File name '/user/username/projects/myproject/node_modules/pkg/require.js' has a '.js' extension - stripping it. +File '/user/username/projects/myproject/node_modules/pkg/require.ts' does not exist. +File '/user/username/projects/myproject/node_modules/pkg/require.tsx' does not exist. +File '/user/username/projects/myproject/node_modules/pkg/require.d.ts' exists - use it as a name resolution result. +Resolved under condition 'require'. +Exiting conditional exports. +Resolving real path for '/user/username/projects/myproject/node_modules/pkg/require.d.ts', result '/user/username/projects/myproject/node_modules/pkg/require.d.ts'. +======== Module name 'pkg' was successfully resolved to '/user/username/projects/myproject/node_modules/pkg/require.d.ts' with Package ID 'pkg/require.d.ts@0.0.1'. ======== +======== Resolving module 'pkg1' from '/user/username/projects/myproject/index.ts'. ======== +Explicitly specified module resolution kind: 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +Loading module 'pkg1' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +Found 'package.json' at '/user/username/projects/myproject/node_modules/pkg1/package.json'. +Entering conditional exports. +Saw non-matching condition 'import'. +Matched 'exports' condition 'require'. +Using 'exports' subpath '.' with target './require.js'. +File name '/user/username/projects/myproject/node_modules/pkg1/require.js' has a '.js' extension - stripping it. +File '/user/username/projects/myproject/node_modules/pkg1/require.ts' does not exist. +File '/user/username/projects/myproject/node_modules/pkg1/require.tsx' does not exist. +File '/user/username/projects/myproject/node_modules/pkg1/require.d.ts' does not exist. +Failed to resolve under condition 'require'. +Exiting conditional exports. +Directory '/user/username/projects/myproject/node_modules/@types' does not exist, skipping all lookups in it. +Directory '/user/username/projects/node_modules' does not exist, skipping all lookups in it. +Directory '/user/username/node_modules' does not exist, skipping all lookups in it. +Directory '/user/node_modules' does not exist, skipping all lookups in it. +Directory '/node_modules' does not exist, skipping all lookups in it. +Searching all ancestor node_modules directories for fallback extensions: JavaScript. +File '/user/username/projects/myproject/node_modules/pkg1/package.json' exists according to earlier cached lookups. +Entering conditional exports. +Saw non-matching condition 'import'. +Matched 'exports' condition 'require'. +Using 'exports' subpath '.' with target './require.js'. +File name '/user/username/projects/myproject/node_modules/pkg1/require.js' has a '.js' extension - stripping it. +File '/user/username/projects/myproject/node_modules/pkg1/require.js' does not exist. +File '/user/username/projects/myproject/node_modules/pkg1/require.jsx' does not exist. +Failed to resolve under condition 'require'. +Exiting conditional exports. +Directory '/user/username/projects/node_modules' does not exist, skipping all lookups in it. +Directory '/user/username/node_modules' does not exist, skipping all lookups in it. +Directory '/user/node_modules' does not exist, skipping all lookups in it. +Directory '/node_modules' does not exist, skipping all lookups in it. +======== Module name 'pkg1' was not resolved. ======== +======== Resolving module './a' from '/user/username/projects/myproject/index.ts'. ======== +Explicitly specified module resolution kind: 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +Loading module as file / folder, candidate module location '/user/username/projects/myproject/a', target file types: TypeScript, JavaScript, Declaration. +File '/user/username/projects/myproject/a.ts' exists - use it as a name resolution result. +======== Module name './a' was successfully resolved to '/user/username/projects/myproject/a.ts'. ======== +File '/user/username/projects/myproject/node_modules/pkg/package.json' exists according to earlier cached lookups. +File '/a/lib/package.json' does not exist. +File '/a/package.json' does not exist. +File '/package.json' does not exist according to earlier cached lookups. +error TS5110: Option 'module' must be set to 'Node16' when option 'moduleResolution' is set to 'Node16'. + +[12:00:44 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/index.ts"] +Program options: {"moduleResolution":3,"watch":true,"traceResolution":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/node_modules/pkg/require.d.ts +/user/username/projects/myproject/index.ts + +No cached semantic diagnostics in the builder:: + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/node_modules/pkg/require.d.ts (used version) +/user/username/projects/myproject/index.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} +/user/username/projects/myproject/package.json: *new* + {"pollingInterval":2000} +/user/username/projects/node_modules: *new* + {"pollingInterval":500} +/user/username/projects/node_modules/@types: *new* + {"pollingInterval":500} +/user/username/projects/package.json: *new* + {"pollingInterval":2000} + +FsWatches:: +/a/lib/lib.d.ts: *new* + {} +/user/username/projects: *new* + {} +/user/username/projects/myproject: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/index.ts: *new* + {} +/user/username/projects/myproject/node_modules/pkg/package.json: *new* + {} +/user/username/projects/myproject/node_modules/pkg/require.d.ts: *new* + {} +/user/username/projects/myproject/node_modules/pkg1/package.json: *new* + {} +/user/username/projects/myproject/tsconfig.json: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} +/user/username/projects/myproject/node_modules: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +exports.x = 10; + + +//// [/user/username/projects/myproject/index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + + + +Change:: modify aFile by adding import + +Input:: +//// [/user/username/projects/myproject/a.ts] +export const x = 10; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +>> Screen clear +[12:00:47 AM] File change detected. Starting incremental compilation... + +File '/a/lib/package.json' does not exist according to earlier cached lookups. +File '/a/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/myproject/node_modules/pkg/package.json' exists according to earlier cached lookups. +File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +======== Resolving module 'pkg' from '/user/username/projects/myproject/a.ts'. ======== +Explicitly specified module resolution kind: 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +Loading module 'pkg' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +File '/user/username/projects/myproject/node_modules/pkg/package.json' exists according to earlier cached lookups. +Entering conditional exports. +Saw non-matching condition 'import'. +Matched 'exports' condition 'require'. +Using 'exports' subpath '.' with target './require.js'. +File name '/user/username/projects/myproject/node_modules/pkg/require.js' has a '.js' extension - stripping it. +File '/user/username/projects/myproject/node_modules/pkg/require.ts' does not exist. +File '/user/username/projects/myproject/node_modules/pkg/require.tsx' does not exist. +File '/user/username/projects/myproject/node_modules/pkg/require.d.ts' exists - use it as a name resolution result. +Resolved under condition 'require'. +Exiting conditional exports. +Resolving real path for '/user/username/projects/myproject/node_modules/pkg/require.d.ts', result '/user/username/projects/myproject/node_modules/pkg/require.d.ts'. +======== Module name 'pkg' was successfully resolved to '/user/username/projects/myproject/node_modules/pkg/require.d.ts' with Package ID 'pkg/require.d.ts@0.0.1'. ======== +File '/user/username/projects/myproject/node_modules/pkg/package.json' exists according to earlier cached lookups. +File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. +File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +File '/user/username/package.json' does not exist according to earlier cached lookups. +File '/user/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +Reusing resolution of module 'pkg' from '/user/username/projects/myproject/index.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/node_modules/pkg/require.d.ts' with Package ID 'pkg/require.d.ts@0.0.1'. +Reusing resolution of module './a' from '/user/username/projects/myproject/index.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/a.ts'. +Reusing resolution of module 'pkg1' from '/user/username/projects/myproject/index.ts' of old program, it was not resolved. +File '/a/lib/package.json' does not exist according to earlier cached lookups. +File '/a/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +error TS5110: Option 'module' must be set to 'Node16' when option 'moduleResolution' is set to 'Node16'. + +[12:00:54 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/index.ts"] +Program options: {"moduleResolution":3,"watch":true,"traceResolution":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: SafeModules +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/node_modules/pkg/require.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/index.ts + +No cached semantic diagnostics in the builder:: + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/a.ts (computed .d.ts) +/user/username/projects/myproject/index.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] file written with same contents +//// [/user/username/projects/myproject/index.js] file written with same contents diff --git a/tests/cases/compiler/importAttributesNonstring.ts b/tests/cases/compiler/importAttributesNonstring.ts new file mode 100644 index 0000000000000..b904ea398b95d --- /dev/null +++ b/tests/cases/compiler/importAttributesNonstring.ts @@ -0,0 +1,13 @@ +// @module: nodenext +// @filename: mod.mts +import * as thing1 from "./mod.mjs" with {field: 0}; + +import * as thing2 from "./mod.mjs" with {field: `a`}; + +import * as thing3 from "./mod.mjs" with {field: /a/g}; + +import * as thing4 from "./mod.mjs" with {field: ["a"]}; + +import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; + +import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} \ No newline at end of file diff --git a/tests/cases/compiler/parseImportAttributesError.ts b/tests/cases/compiler/parseImportAttributesError.ts new file mode 100644 index 0000000000000..df87a0ed1a9be --- /dev/null +++ b/tests/cases/compiler/parseImportAttributesError.ts @@ -0,0 +1,27 @@ +// @noImplicitReferences: true +// @module: nodenext +// @declaration: true +// @outDir: out +// @filename: /node_modules/pkg/package.json +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} + +// @filename: /node_modules/pkg/import.d.ts +export interface ImportInterface {} + +// @filename: /node_modules/pkg/require.d.ts +export interface RequireInterface {} + +// @filename: /index.ts +export type LocalInterface = + & import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface + & import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface); +export const b = (null as any as import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface); diff --git a/tests/cases/conformance/importAttributes/importAttributes1.ts b/tests/cases/conformance/importAttributes/importAttributes1.ts new file mode 100644 index 0000000000000..20912d73c62d4 --- /dev/null +++ b/tests/cases/conformance/importAttributes/importAttributes1.ts @@ -0,0 +1,34 @@ +// @declaration: true +// @target: es2015 +// @module: es2015, commonjs, esnext + +// @filename: 0.ts +export const a = 1; +export const b = 2; + +// @filename: 1.ts +import './0' with { type: "json" } +import { a, b } from './0' with { "type": "json" } +import * as foo from './0' with { type: "json" } +a; +b; +foo.a; +foo.b; +// @filename: 2.ts +import { a, b } from './0' with {} +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } +a; +b; +c; +d; +// @filename: 3.ts +const a = import('./0') +const b = import('./0', { with: { type: "json" } }) +const c = import('./0', { with: { type: "json", ttype: "typo" } }) +const d = import('./0', { with: {} }) +const dd = import('./0', {}) +declare function foo(): any; +const e = import('./0', foo()) +const f = import() +const g = import('./0', {}, {}) +const h = import('./0', { with: { type: "json" }},) diff --git a/tests/cases/conformance/importAttributes/importAttributes2.ts b/tests/cases/conformance/importAttributes/importAttributes2.ts new file mode 100644 index 0000000000000..5852a4eb21f53 --- /dev/null +++ b/tests/cases/conformance/importAttributes/importAttributes2.ts @@ -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' with { type: "json" } +export { a, b } from './0' with { type: "json" } +export * from './0' with { type: "json" } +export * as ns from './0' with { type: "json" } + +// @filename: 2.ts +export { a, b } from './0' with {} +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } diff --git a/tests/cases/conformance/importAttributes/importAttributes3.ts b/tests/cases/conformance/importAttributes/importAttributes3.ts new file mode 100644 index 0000000000000..e51f08322930c --- /dev/null +++ b/tests/cases/conformance/importAttributes/importAttributes3.ts @@ -0,0 +1,14 @@ +// @declaration: true +// @target: es2015 +// @module: es2015, esnext + +// @filename: 0.ts +export interface I { } + +// @filename: 1.ts +export type {} from './0' with { type: "json" } +export type { I } from './0' with { type: "json" } + +// @filename: 2.ts +import type { I } from './0' with { type: "json" } +import type * as foo from './0' with { type: "json" } diff --git a/tests/cases/conformance/importAttributes/importAttributes4.ts b/tests/cases/conformance/importAttributes/importAttributes4.ts new file mode 100644 index 0000000000000..e52b6b1167eab --- /dev/null +++ b/tests/cases/conformance/importAttributes/importAttributes4.ts @@ -0,0 +1 @@ +import * as f from "./first" with \ No newline at end of file diff --git a/tests/cases/conformance/importAttributes/importAttributes5.ts b/tests/cases/conformance/importAttributes/importAttributes5.ts new file mode 100644 index 0000000000000..12d141e2a30a3 --- /dev/null +++ b/tests/cases/conformance/importAttributes/importAttributes5.ts @@ -0,0 +1 @@ +import * as f from "./first" with { \ No newline at end of file diff --git a/tests/cases/conformance/importAttributes/importAttributes6.ts b/tests/cases/conformance/importAttributes/importAttributes6.ts new file mode 100644 index 0000000000000..d76afe8699e3f --- /dev/null +++ b/tests/cases/conformance/importAttributes/importAttributes6.ts @@ -0,0 +1,8 @@ +// @module: nodenext +// @filename: mod.mts +import * as thing1 from "./mod.mjs" with {field: 0}; +import * as thing2 from "./mod.mjs" with {field: `a`}; +import * as thing3 from "./mod.mjs" with {field: /a/g}; +import * as thing4 from "./mod.mjs" with {field: ["a"]}; +import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; +import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} diff --git a/tests/cases/conformance/importAttributes/importAttributes7.ts b/tests/cases/conformance/importAttributes/importAttributes7.ts new file mode 100644 index 0000000000000..0b03554469e56 --- /dev/null +++ b/tests/cases/conformance/importAttributes/importAttributes7.ts @@ -0,0 +1,19 @@ +// @module: esnext +// @lib: es2015 + +// @filename: /a.ts +export default { + a: "a", + b: "b", + 1: "1", +} + +// @filename: /b.ts +import a from "./a" with { a: "a", "b": "b", 1: "1" }; + +export async function f() { + const a = import("./a", { + with: { a: "a", "b": "b", 1: "1" }, + }); + a; +} diff --git a/tests/cases/conformance/importAttributes/importAttributes8.ts b/tests/cases/conformance/importAttributes/importAttributes8.ts new file mode 100644 index 0000000000000..93bfabd160f01 --- /dev/null +++ b/tests/cases/conformance/importAttributes/importAttributes8.ts @@ -0,0 +1,13 @@ +// @module: esnext +// @lib: es2015 + +// @filename: /a.ts +export default { + a: "a", + b: "b", + 1: "1", +} + +// @filename: /b.ts +import a from "./a" +with { a: "a", "b": "b", 1: "1" }; // ok diff --git a/tests/cases/conformance/node/nodeModulesImportAttributes.ts b/tests/cases/conformance/node/nodeModulesImportAttributes.ts new file mode 100644 index 0000000000000..9e2a3271c0218 --- /dev/null +++ b/tests/cases/conformance/node/nodeModulesImportAttributes.ts @@ -0,0 +1,13 @@ +// @module: node16,nodenext +// @resolveJsonModule: true +// @filename: index.ts +import json from "./package.json" with { type: "json" }; +// @filename: otherc.cts +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine +// @filename: package.json +{ + "name": "pkg", + "private": true, + "type": "module" +} diff --git a/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts b/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts new file mode 100644 index 0000000000000..181853d1fa02d --- /dev/null +++ b/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit1.ts @@ -0,0 +1,29 @@ +// @noImplicitReferences: true +// @module: node16,nodenext +// @declaration: true +// @outDir: out +// @filename: /node_modules/pkg/package.json +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +// @filename: /node_modules/pkg/import.d.ts +export interface ImportInterface {} +// @filename: /node_modules/pkg/require.d.ts +export interface RequireInterface {} +// @filename: /index.ts +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts b/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts new file mode 100644 index 0000000000000..b8cc7f112fda3 --- /dev/null +++ b/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmit2.ts @@ -0,0 +1,34 @@ +// @noImplicitReferences: true +// @module: node16,nodenext +// @declaration: true +// @outDir: out +// @filename: /node_modules/pkg/package.json +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +// @filename: /node_modules/pkg/import.d.ts +export interface ImportInterface {} +// @filename: /node_modules/pkg/require.d.ts +export interface RequireInterface {} +// @filename: /package.json +{ + "private": true, + "type": "module" +} +// @filename: /index.ts +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; + +export interface LocalInterface extends RequireInterface, ImportInterface {} + +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +export interface Loc extends Req, Imp {} + +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts b/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts new file mode 100644 index 0000000000000..2aee1dfac573a --- /dev/null +++ b/tests/cases/conformance/node/nodeModulesImportAttributesModeDeclarationEmitErrors.ts @@ -0,0 +1,29 @@ +// @noImplicitReferences: true +// @module: node16,nodenext +// @declaration: true +// @outDir: out +// @filename: /node_modules/pkg/package.json +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +// @filename: /node_modules/pkg/import.d.ts +export interface ImportInterface {} +// @filename: /node_modules/pkg/require.d.ts +export interface RequireInterface {} +// @filename: /index.ts +// incorrect mode +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; +// not type-only +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; +// not exclusively type-only +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; + +export interface LocalInterface extends RequireInterface, ImportInterface {} + + + diff --git a/tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts b/tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts new file mode 100644 index 0000000000000..45bf0f409e569 --- /dev/null +++ b/tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmit.ts @@ -0,0 +1,24 @@ +// @noImplicitReferences: true +// @module: node16,nodenext +// @declaration: true +// @outDir: out +// @filename: /node_modules/pkg/package.json +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +// @filename: /node_modules/pkg/import.d.ts +export interface ImportInterface {} +// @filename: /node_modules/pkg/require.d.ts +export interface RequireInterface {} +// @filename: /index.ts +export type LocalInterface = + & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); diff --git a/tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmitErrors.ts b/tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmitErrors.ts new file mode 100644 index 0000000000000..e5c7c1420f314 --- /dev/null +++ b/tests/cases/conformance/node/nodeModulesImportAttributesTypeModeDeclarationEmitErrors.ts @@ -0,0 +1,72 @@ +// @module: node16,nodenext +// @declaration: true +// @outDir: out +// @filename: /node_modules/pkg/package.json +{ + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } +} +// @filename: /node_modules/pkg/import.d.ts +export interface ImportInterface {} + +// @filename: /node_modules/pkg/require.d.ts +export interface RequireInterface {} + +// @filename: /index.ts +export type LocalInterface = + & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface + & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); +export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); + +// @filename: /other.ts +// missing with: +export type LocalInterface = + & import("pkg", {"resolution-mode": "require"}).RequireInterface + & import("pkg", {"resolution-mode": "import"}).ImportInterface; + +export const a = (null as any as import("pkg", {"resolution-mode": "require"}).RequireInterface); +export const b = (null as any as import("pkg", {"resolution-mode": "import"}).ImportInterface); + +// @filename: /other2.ts +// wrong attribute key +export type LocalInterface = + & import("pkg", { with: {"bad": "require"} }).RequireInterface + & import("pkg", { with: {"bad": "import"} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); +export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); + +// @filename: /other3.ts +// Array instead of object-y thing +export type LocalInterface = + & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface + & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; + +export const a = (null as any as import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface); +export const b = (null as any as import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface); + +// @filename: /other4.ts +// Indirected attribute objecty-thing - not allowed +type Attribute1 = { with: {"resolution-mode": "require"} }; +type Attribute2 = { with: {"resolution-mode": "import"} }; + +export type LocalInterface = + & import("pkg", Attribute1).RequireInterface + & import("pkg", Attribute2).ImportInterface; + +export const a = (null as any as import("pkg", Attribute1).RequireInterface); +export const b = (null as any as import("pkg", Attribute2).ImportInterface); + +// @filename: /other5.ts +export type LocalInterface = + & import("pkg", { with: {} }).RequireInterface + & import("pkg", { with: {} }).ImportInterface; + +export const a = (null as any as import("pkg", { with: {} }).RequireInterface); +export const b = (null as any as import("pkg", { with: {} }).ImportInterface); \ No newline at end of file diff --git a/tests/cases/fourslash/completionImportAttributes.ts b/tests/cases/fourslash/completionImportAttributes.ts new file mode 100644 index 0000000000000..3a578e66122ba --- /dev/null +++ b/tests/cases/fourslash/completionImportAttributes.ts @@ -0,0 +1,13 @@ +/// + +// @target: esnext +// @module: esnext + +// @filename: main.ts +////import("./other.json", {/*0*/}); +////import("./other.json", { wi/*1*/}); + +// @filename: other.json +////{} + +verify.baselineCompletions(); diff --git a/tests/cases/fourslash/completionsImportWithKeyword.ts b/tests/cases/fourslash/completionsImportWithKeyword.ts new file mode 100644 index 0000000000000..4c4016bf5494e --- /dev/null +++ b/tests/cases/fourslash/completionsImportWithKeyword.ts @@ -0,0 +1,19 @@ +/// + +// @allowJs: true +// @Filename: a.ts +//// const f = { +//// a: 1 +////}; +//// import * as thing from "thing" /*0*/ +//// export { foo } from "foo" /*1*/ +//// import "foo" as /*2*/ +//// import "foo" w/*3*/ +//// import * as that from "that" +//// /*4*/ +//// import * /*5*/ as those from "those" + +// @Filename: b.js +//// import * as thing from "thing" /*js*/; + +verify.baselineCompletions(); diff --git a/tests/cases/fourslash/getOccurrencesNonStringImportAttributes.ts b/tests/cases/fourslash/getOccurrencesNonStringImportAttributes.ts new file mode 100644 index 0000000000000..48611e02ee5f3 --- /dev/null +++ b/tests/cases/fourslash/getOccurrencesNonStringImportAttributes.ts @@ -0,0 +1,7 @@ +/// + +// @module: nodenext +////import * as react from "react" with { cache: /**/0 }; +////react.Children; + +verify.baselineDocumentHighlights(""); diff --git a/tests/cases/fourslash/outliningSpansForImportAndExportAttributes.ts b/tests/cases/fourslash/outliningSpansForImportAndExportAttributes.ts new file mode 100644 index 0000000000000..52a3266b38cb6 --- /dev/null +++ b/tests/cases/fourslash/outliningSpansForImportAndExportAttributes.ts @@ -0,0 +1,48 @@ +/// + +//// import { a1, a2 } from "a"; +//// ; +//// import { +//// } from "a"; +//// ; +//// import [|{ +//// b1, +//// b2, +//// }|] from "b"; +//// ; +//// import j1 from "./j" with { type: "json" }; +//// ; +//// import j2 from "./j" with { +//// }; +//// ; +//// import j3 from "./j" with [|{ +//// type: "json" +//// }|]; +//// ; +//// [|import { a5, a6 } from "a"; +//// import [|{ +//// a7, +//// a8, +//// }|] from "a";|] +//// export { a1, a2 }; +//// ; +//// export { a3, a4 } from "a"; +//// ; +//// export { +//// }; +//// ; +//// export [|{ +//// b1, +//// b2, +//// }|]; +//// ; +//// export { +//// } from "b"; +//// ; +//// export [|{ +//// b3, +//// b4, +//// }|] from "b"; +//// ; + +verify.outliningSpansInCurrentFile(test.ranges()); From 6489c393e1125ff21aefc6875190dcd1fd4cab90 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Sat, 26 Aug 2023 00:05:56 +0300 Subject: [PATCH 02/21] update diagnostic message --- src/compiler/checker.ts | 2 +- src/compiler/diagnosticMessages.json | 4 ++++ ...ortAttributes1(module=commonjs).errors.txt | 20 ++++++++-------- ...mportAttributes1(module=es2015).errors.txt | 20 ++++++++-------- ...ortAttributes2(module=commonjs).errors.txt | 24 +++++++++---------- ...mportAttributes2(module=es2015).errors.txt | 24 +++++++++---------- ...mportAttributes3(module=es2015).errors.txt | 16 ++++++------- 7 files changed, 57 insertions(+), 53 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6a57a3136ec0b..ae219f82ef00d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -45087,7 +45087,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const message = declaration.attributes ? moduleKind === ModuleKind.NodeNext ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_transpile_to_CommonJS_require_calls - : Diagnostics.Import_attributes_cannot_be_used_with_type_only_imports_or_exports + : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext : moduleKind === ModuleKind.NodeNext ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_transpile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 789666a8dc311..b3143d30451f2 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3599,6 +3599,10 @@ "category": "Error", "code": 2822 }, + "Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'.": { + "category": "Error", + "code": 2823 + }, "Cannot find namespace '{0}'. Did you mean '{1}'?": { "category": "Error", "code": 2833 diff --git a/tests/baselines/reference/importAttributes1(module=commonjs).errors.txt b/tests/baselines/reference/importAttributes1(module=commonjs).errors.txt index 694896a8a8769..88b174f0b1ae4 100644 --- a/tests/baselines/reference/importAttributes1(module=commonjs).errors.txt +++ b/tests/baselines/reference/importAttributes1(module=commonjs).errors.txt @@ -1,8 +1,8 @@ -1.ts(1,14): error TS2856: Import attributes cannot be used with type-only imports or exports. -1.ts(2,28): error TS2856: Import attributes cannot be used with type-only imports or exports. -1.ts(3,28): error TS2856: Import attributes cannot be used with type-only imports or exports. -2.ts(1,28): error TS2856: Import attributes cannot be used with type-only imports or exports. -2.ts(2,38): error TS2856: Import attributes cannot be used with type-only imports or exports. +1.ts(1,14): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(3,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. 3.ts(2,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. 3.ts(3,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. 3.ts(4,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. @@ -21,13 +21,13 @@ ==== 1.ts (3 errors) ==== import './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import { a, b } from './0' with { "type": "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import * as foo from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. a; b; foo.a; @@ -35,10 +35,10 @@ ==== 2.ts (2 errors) ==== import { a, b } from './0' with {} ~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. a; b; c; diff --git a/tests/baselines/reference/importAttributes1(module=es2015).errors.txt b/tests/baselines/reference/importAttributes1(module=es2015).errors.txt index 0603408ac3b3d..e8259d6d21743 100644 --- a/tests/baselines/reference/importAttributes1(module=es2015).errors.txt +++ b/tests/baselines/reference/importAttributes1(module=es2015).errors.txt @@ -1,8 +1,8 @@ -1.ts(1,14): error TS2856: Import attributes cannot be used with type-only imports or exports. -1.ts(2,28): error TS2856: Import attributes cannot be used with type-only imports or exports. -1.ts(3,28): error TS2856: Import attributes cannot be used with type-only imports or exports. -2.ts(1,28): error TS2856: Import attributes cannot be used with type-only imports or exports. -2.ts(2,38): error TS2856: Import attributes cannot be used with type-only imports or exports. +1.ts(1,14): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(3,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. 3.ts(1,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. 3.ts(2,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. 3.ts(3,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. @@ -21,13 +21,13 @@ ==== 1.ts (3 errors) ==== import './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import { a, b } from './0' with { "type": "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import * as foo from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. a; b; foo.a; @@ -35,10 +35,10 @@ ==== 2.ts (2 errors) ==== import { a, b } from './0' with {} ~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. a; b; c; diff --git a/tests/baselines/reference/importAttributes2(module=commonjs).errors.txt b/tests/baselines/reference/importAttributes2(module=commonjs).errors.txt index 7444a77afec0a..0d4945bf1e550 100644 --- a/tests/baselines/reference/importAttributes2(module=commonjs).errors.txt +++ b/tests/baselines/reference/importAttributes2(module=commonjs).errors.txt @@ -1,9 +1,9 @@ -1.ts(1,22): error TS2856: Import attributes cannot be used with type-only imports or exports. -1.ts(2,28): error TS2856: Import attributes cannot be used with type-only imports or exports. -1.ts(3,21): error TS2856: Import attributes cannot be used with type-only imports or exports. -1.ts(4,27): error TS2856: Import attributes cannot be used with type-only imports or exports. -2.ts(1,28): error TS2856: Import attributes cannot be used with type-only imports or exports. -2.ts(2,38): error TS2856: Import attributes cannot be used with type-only imports or exports. +1.ts(1,22): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(3,21): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(4,27): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ==== 0.ts (0 errors) ==== @@ -13,22 +13,22 @@ ==== 1.ts (4 errors) ==== export {} from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export { a, b } from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export * from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export * as ns from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ==== 2.ts (2 errors) ==== export { a, b } from './0' with {} ~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes2(module=es2015).errors.txt b/tests/baselines/reference/importAttributes2(module=es2015).errors.txt index 7444a77afec0a..0d4945bf1e550 100644 --- a/tests/baselines/reference/importAttributes2(module=es2015).errors.txt +++ b/tests/baselines/reference/importAttributes2(module=es2015).errors.txt @@ -1,9 +1,9 @@ -1.ts(1,22): error TS2856: Import attributes cannot be used with type-only imports or exports. -1.ts(2,28): error TS2856: Import attributes cannot be used with type-only imports or exports. -1.ts(3,21): error TS2856: Import attributes cannot be used with type-only imports or exports. -1.ts(4,27): error TS2856: Import attributes cannot be used with type-only imports or exports. -2.ts(1,28): error TS2856: Import attributes cannot be used with type-only imports or exports. -2.ts(2,38): error TS2856: Import attributes cannot be used with type-only imports or exports. +1.ts(1,22): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(3,21): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(4,27): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ==== 0.ts (0 errors) ==== @@ -13,22 +13,22 @@ ==== 1.ts (4 errors) ==== export {} from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export { a, b } from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export * from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export * as ns from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ==== 2.ts (2 errors) ==== export { a, b } from './0' with {} ~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes3(module=es2015).errors.txt b/tests/baselines/reference/importAttributes3(module=es2015).errors.txt index c85b0aa3ef7e5..f34fea44998ec 100644 --- a/tests/baselines/reference/importAttributes3(module=es2015).errors.txt +++ b/tests/baselines/reference/importAttributes3(module=es2015).errors.txt @@ -1,7 +1,7 @@ -1.ts(1,27): error TS2856: Import attributes cannot be used with type-only imports or exports. -1.ts(2,30): error TS2856: Import attributes cannot be used with type-only imports or exports. -2.ts(1,31): error TS2856: Import attributes cannot be used with type-only imports or exports. -2.ts(2,33): error TS2856: Import attributes cannot be used with type-only imports or exports. +1.ts(1,27): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(2,30): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(1,31): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(2,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ==== 0.ts (0 errors) ==== @@ -10,16 +10,16 @@ ==== 1.ts (2 errors) ==== export type {} from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export type { I } from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ==== 2.ts (2 errors) ==== import type { I } from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import type * as foo from './0' with { type: "json" } ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. \ No newline at end of file From 4c8bad14fa96e900d1f36f1fc85ac32edfb135ae Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Sat, 26 Aug 2023 00:21:06 +0300 Subject: [PATCH 03/21] update baseline --- ...ModulesImportAttributes(module=node16).errors.txt | 8 ++++---- ...tesModeDeclarationEmit1(module=node16).errors.txt | 8 ++++---- ...tesModeDeclarationEmit2(module=node16).errors.txt | 8 ++++---- ...deDeclarationEmitErrors(module=node16).errors.txt | 12 ++++++------ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/baselines/reference/nodeModulesImportAttributes(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributes(module=node16).errors.txt index f5703ff09d5fc..eebc7c09c975c 100644 --- a/tests/baselines/reference/nodeModulesImportAttributes(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributes(module=node16).errors.txt @@ -1,6 +1,6 @@ error TS2468: Cannot find global value 'Promise'. -index.ts(1,35): error TS2856: Import attributes cannot be used with type-only imports or exports. -otherc.cts(1,35): error TS2856: Import attributes cannot be used with type-only imports or exports. +index.ts(1,35): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +otherc.cts(1,35): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. otherc.cts(2,15): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. @@ -8,11 +8,11 @@ otherc.cts(2,15): error TS2712: A dynamic import call in ES5/ES3 requires the 'P ==== index.ts (1 errors) ==== import json from "./package.json" with { type: "json" }; ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ==== otherc.cts (2 errors) ==== import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. const json2 = import("./package.json", { with: { type: "json" } }); // should be fine ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt index baa2d3262c1c5..711ee31527328 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt @@ -1,7 +1,7 @@ /index.ts(2,15): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(6,50): error TS2856: Import attributes cannot be used with type-only imports or exports. +/index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS2856: Import attributes cannot be used with type-only imports or exports. +/index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. /index.ts(11,15): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. @@ -15,12 +15,12 @@ import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt index 61879a8cf5146..90dc175567add 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt @@ -1,7 +1,7 @@ /index.ts(1,15): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -/index.ts(6,50): error TS2856: Import attributes cannot be used with type-only imports or exports. -/index.ts(7,49): error TS2856: Import attributes cannot be used with type-only imports or exports. +/index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +/index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. /index.ts(10,15): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. @@ -17,10 +17,10 @@ ~~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt index 7d00b1daae965..b7e3766635732 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node16).errors.txt @@ -1,15 +1,15 @@ -/index.ts(2,45): error TS2856: Import attributes cannot be used with type-only imports or exports. +/index.ts(2,45): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. /index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(4,39): error TS2856: Import attributes cannot be used with type-only imports or exports. -/index.ts(6,76): error TS2856: Import attributes cannot be used with type-only imports or exports. +/index.ts(4,39): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +/index.ts(6,76): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ==== /index.ts (5 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. // not type-only @@ -17,11 +17,11 @@ ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes cannot be used with type-only imports or exports. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export interface LocalInterface extends RequireInterface, ImportInterface {} From 1a0fb93e60612688ec44201dd2af88f0adb77178 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Sat, 26 Aug 2023 18:39:23 +0300 Subject: [PATCH 04/21] mark util function as internal --- src/compiler/utilities.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index f8dd89a5cd93e..505666468e299 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -10437,7 +10437,7 @@ export function getPropertyNameFromType(type: StringLiteralType | NumberLiteralT return Debug.fail(); } -/** @intre */ +/** @internal */ export function hasResolutionModeOverride(node: ImportTypeNode | ImportDeclaration | ExportDeclaration | undefined) { if (node === undefined) { return false; From 642667e09124318ce963f456c6f040e5b41103a7 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Sat, 26 Aug 2023 21:33:52 +0300 Subject: [PATCH 05/21] emit import attributes --- src/compiler/emitter.ts | 13 +++++ src/compiler/factory/nodeFactory.ts | 2 +- src/compiler/program.ts | 4 +- tests/baselines/reference/api/typescript.d.ts | 2 - .../reference/importAttributes6.errors.txt | 36 ++++++------- .../baselines/reference/importAttributes6.js | 12 ++--- .../reference/importAttributes6.symbols | 14 ++--- .../reference/importAttributes6.types | 12 ++--- .../importAttributesNonstring.errors.txt | 32 ----------- .../reference/importAttributesNonstring.js | 17 ------ .../importAttributesNonstring.symbols | 24 --------- .../reference/importAttributesNonstring.types | 38 ------------- ...tionEmitDynamicImportWithPackageExports.js | 6 +-- ...nEmitDynamicImportWithPackageExports.types | 12 ++--- ...DeclarationEmit1(module=node16).errors.txt | 8 +-- ...odeDeclarationEmit1(module=node16).symbols | 4 ++ ...sModeDeclarationEmit1(module=node16).types | 7 ++- ...clarationEmit1(module=nodenext).errors.txt | 8 +-- ...eDeclarationEmit1(module=nodenext).symbols | 4 ++ ...odeDeclarationEmit1(module=nodenext).types | 7 ++- ...DeclarationEmit2(module=node16).errors.txt | 8 +-- ...odeDeclarationEmit2(module=node16).symbols | 4 ++ ...sModeDeclarationEmit2(module=node16).types | 7 ++- ...clarationEmit2(module=nodenext).errors.txt | 8 +-- ...eDeclarationEmit2(module=nodenext).symbols | 4 ++ ...odeDeclarationEmit2(module=nodenext).types | 7 ++- ...eDeclarationEmit(module=node16).errors.txt | 29 ---------- ...sTypeModeDeclarationEmit(module=node16).js | 4 +- ...ModeDeclarationEmit(module=node16).symbols | 6 +++ ...peModeDeclarationEmit(module=node16).types | 11 ++-- ...eclarationEmit(module=nodenext).errors.txt | 29 ---------- ...ypeModeDeclarationEmit(module=nodenext).js | 4 +- ...deDeclarationEmit(module=nodenext).symbols | 6 +++ ...ModeDeclarationEmit(module=nodenext).types | 11 ++-- ...rationEmitErrors(module=node16).errors.txt | 8 +-- ...odeDeclarationEmitErrors(module=node16).js | 14 ++--- ...clarationEmitErrors(module=node16).symbols | 2 + ...DeclarationEmitErrors(module=node16).types | 8 +-- ...tionEmitErrors(module=nodenext).errors.txt | 8 +-- ...eDeclarationEmitErrors(module=nodenext).js | 14 ++--- ...arationEmitErrors(module=nodenext).symbols | 2 + ...clarationEmitErrors(module=nodenext).types | 8 +-- ...TypeModeDeclarationEmit1(module=node16).js | 30 +---------- ...peModeDeclarationEmit1(module=nodenext).js | 30 +---------- ...deDeclarationEmitErrors1(module=node16).js | 8 +-- ...DeclarationEmitErrors1(module=nodenext).js | 8 +-- ...s-with-partially-used-import-attributes.js | 54 +++++++++---------- .../compiler/importAttributesNonstring.ts | 13 ----- .../importAttributes/importAttributes6.ts | 12 ++--- 49 files changed, 202 insertions(+), 417 deletions(-) delete mode 100644 tests/baselines/reference/importAttributesNonstring.errors.txt delete mode 100644 tests/baselines/reference/importAttributesNonstring.js delete mode 100644 tests/baselines/reference/importAttributesNonstring.symbols delete mode 100644 tests/baselines/reference/importAttributesNonstring.types delete mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).errors.txt delete mode 100644 tests/cases/compiler/importAttributesNonstring.ts diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 9515afa8fbafc..bde961a96b7d7 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2966,6 +2966,19 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri writeSpace(); writePunctuation("}"); } + if (node.attributes) { + writePunctuation(","); + writeSpace(); + writePunctuation("{"); + writeSpace(); + writeKeyword("with"); + writePunctuation(":"); + writeSpace(); + const elements = node.attributes.attributes.elements; + emitList(node.attributes.attributes, elements, ListFormat.ImportAttributes); + writeSpace(); + writePunctuation("}"); + } writePunctuation(")"); if (node.qualifier) { writePunctuation("."); diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index df6c99566c3c3..43f4c1fd22a49 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -2681,8 +2681,8 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode isTypeOf: boolean = node.isTypeOf, ): ImportTypeNode { return node.argument !== argument - || node.attributes !== attributes || node.assertions !== assertions + || node.attributes !== attributes || node.qualifier !== qualifier || node.typeArguments !== typeArguments || node.isTypeOf !== isTypeOf diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 5963b9cb543b5..de15e3ec9cf8d 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -899,14 +899,14 @@ export function getModeForUsageLocation(file: { impliedNodeFormat?: ResolutionMo if ((isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent))) { const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent); if (isTypeOnly) { - const override = getResolutionModeOverride(usage.parent.assertClause); + const override = getResolutionModeOverride(usage.parent.attributes || usage.parent.assertClause); if (override) { return override; } } } if (usage.parent.parent && isImportTypeNode(usage.parent.parent)) { - const override = getResolutionModeOverride(usage.parent.parent.assertions?.assertClause); + const override = getResolutionModeOverride(usage.parent.parent.attributes?.attributes || usage.parent.parent.assertions?.assertClause); if (override) { return override; } diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 3ff54555f73b3..f8c0760bab089 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -9123,8 +9123,6 @@ declare namespace ts { * ``` */ function getJSDocCommentsAndTags(hostNode: Node): readonly (JSDoc | JSDocTag)[]; - /** @intre */ - function hasResolutionModeOverride(node: ImportTypeNode | ImportDeclaration | ExportDeclaration | undefined): boolean; /** @deprecated */ function createUnparsedSourceFile(text: string): UnparsedSource; /** @deprecated */ diff --git a/tests/baselines/reference/importAttributes6.errors.txt b/tests/baselines/reference/importAttributes6.errors.txt index 161c2152e4fba..2334a30a3c3e4 100644 --- a/tests/baselines/reference/importAttributes6.errors.txt +++ b/tests/baselines/reference/importAttributes6.errors.txt @@ -1,28 +1,28 @@ -mod.mts(1,50): error TS2857: Import attribute values must be string literal expressions. -mod.mts(2,50): error TS2857: Import attribute values must be string literal expressions. -mod.mts(3,50): error TS2857: Import attribute values must be string literal expressions. -mod.mts(4,50): error TS2857: Import attribute values must be string literal expressions. -mod.mts(5,50): error TS2857: Import attribute values must be string literal expressions. -mod.mts(6,64): error TS2857: Import attribute values must be string literal expressions. +mod.mts(1,51): error TS2857: Import attribute values must be string literal expressions. +mod.mts(2,51): error TS2857: Import attribute values must be string literal expressions. +mod.mts(3,51): error TS2857: Import attribute values must be string literal expressions. +mod.mts(4,51): error TS2857: Import attribute values must be string literal expressions. +mod.mts(5,51): error TS2857: Import attribute values must be string literal expressions. +mod.mts(6,65): error TS2857: Import attribute values must be string literal expressions. ==== mod.mts (6 errors) ==== - import * as thing1 from "./mod.mjs" with {field: 0}; - ~ + import * as thing1 from "./mod.mjs" with { field: 0 }; + ~ !!! error TS2857: Import attribute values must be string literal expressions. - import * as thing2 from "./mod.mjs" with {field: `a`}; - ~~~ + import * as thing2 from "./mod.mjs" with { field: `a` }; + ~~~ !!! error TS2857: Import attribute values must be string literal expressions. - import * as thing3 from "./mod.mjs" with {field: /a/g}; - ~~~~ + import * as thing3 from "./mod.mjs" with { field: /a/g }; + ~~~~ !!! error TS2857: Import attribute values must be string literal expressions. - import * as thing4 from "./mod.mjs" with {field: ["a"]}; - ~~~~~ + import * as thing4 from "./mod.mjs" with { field: ["a"] }; + ~~~~~ !!! error TS2857: Import attribute values must be string literal expressions. - import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; - ~~~~~~~~ + import * as thing5 from "./mod.mjs" with { field: { a: 0 } }; + ~~~~~~~~ !!! error TS2857: Import attribute values must be string literal expressions. - import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} - ~~~~~~~~~~~~~ + import * as thing6 from "./mod.mjs" with { type: "json", field: 0..toString() }; + ~~~~~~~~~~~~~ !!! error TS2857: Import attribute values must be string literal expressions. \ No newline at end of file diff --git a/tests/baselines/reference/importAttributes6.js b/tests/baselines/reference/importAttributes6.js index c1a77d733f01d..6d346c55c8e5a 100644 --- a/tests/baselines/reference/importAttributes6.js +++ b/tests/baselines/reference/importAttributes6.js @@ -1,12 +1,12 @@ //// [tests/cases/conformance/importAttributes/importAttributes6.ts] //// //// [mod.mts] -import * as thing1 from "./mod.mjs" with {field: 0}; -import * as thing2 from "./mod.mjs" with {field: `a`}; -import * as thing3 from "./mod.mjs" with {field: /a/g}; -import * as thing4 from "./mod.mjs" with {field: ["a"]}; -import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; -import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} +import * as thing1 from "./mod.mjs" with { field: 0 }; +import * as thing2 from "./mod.mjs" with { field: `a` }; +import * as thing3 from "./mod.mjs" with { field: /a/g }; +import * as thing4 from "./mod.mjs" with { field: ["a"] }; +import * as thing5 from "./mod.mjs" with { field: { a: 0 } }; +import * as thing6 from "./mod.mjs" with { type: "json", field: 0..toString() }; //// [mod.mjs] diff --git a/tests/baselines/reference/importAttributes6.symbols b/tests/baselines/reference/importAttributes6.symbols index 5c115c20b333d..b46ae41350e9a 100644 --- a/tests/baselines/reference/importAttributes6.symbols +++ b/tests/baselines/reference/importAttributes6.symbols @@ -1,23 +1,23 @@ //// [tests/cases/conformance/importAttributes/importAttributes6.ts] //// === mod.mts === -import * as thing1 from "./mod.mjs" with {field: 0}; +import * as thing1 from "./mod.mjs" with { field: 0 }; >thing1 : Symbol(thing1, Decl(mod.mts, 0, 6)) -import * as thing2 from "./mod.mjs" with {field: `a`}; +import * as thing2 from "./mod.mjs" with { field: `a` }; >thing2 : Symbol(thing2, Decl(mod.mts, 1, 6)) -import * as thing3 from "./mod.mjs" with {field: /a/g}; +import * as thing3 from "./mod.mjs" with { field: /a/g }; >thing3 : Symbol(thing3, Decl(mod.mts, 2, 6)) -import * as thing4 from "./mod.mjs" with {field: ["a"]}; +import * as thing4 from "./mod.mjs" with { field: ["a"] }; >thing4 : Symbol(thing4, Decl(mod.mts, 3, 6)) -import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; +import * as thing5 from "./mod.mjs" with { field: { a: 0 } }; >thing5 : Symbol(thing5, Decl(mod.mts, 4, 6)) ->a : Symbol(a, Decl(mod.mts, 4, 50)) +>a : Symbol(a, Decl(mod.mts, 4, 51)) -import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} +import * as thing6 from "./mod.mjs" with { type: "json", field: 0..toString() }; >thing6 : Symbol(thing6, Decl(mod.mts, 5, 6)) >0..toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) >toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/importAttributes6.types b/tests/baselines/reference/importAttributes6.types index c6db109db2e36..89fdd52c30d22 100644 --- a/tests/baselines/reference/importAttributes6.types +++ b/tests/baselines/reference/importAttributes6.types @@ -1,33 +1,33 @@ //// [tests/cases/conformance/importAttributes/importAttributes6.ts] //// === mod.mts === -import * as thing1 from "./mod.mjs" with {field: 0}; +import * as thing1 from "./mod.mjs" with { field: 0 }; >thing1 : typeof thing1 >field : any -import * as thing2 from "./mod.mjs" with {field: `a`}; +import * as thing2 from "./mod.mjs" with { field: `a` }; >thing2 : typeof thing1 >field : any -import * as thing3 from "./mod.mjs" with {field: /a/g}; +import * as thing3 from "./mod.mjs" with { field: /a/g }; >thing3 : typeof thing1 >field : any >/a/g : RegExp -import * as thing4 from "./mod.mjs" with {field: ["a"]}; +import * as thing4 from "./mod.mjs" with { field: ["a"] }; >thing4 : typeof thing1 >field : any >["a"] : string[] >"a" : "a" -import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; +import * as thing5 from "./mod.mjs" with { field: { a: 0 } }; >thing5 : typeof thing1 >field : any >{ a: 0 } : { a: number; } >a : number >0 : 0 -import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} +import * as thing6 from "./mod.mjs" with { type: "json", field: 0..toString() }; >thing6 : typeof thing1 >type : any >field : any diff --git a/tests/baselines/reference/importAttributesNonstring.errors.txt b/tests/baselines/reference/importAttributesNonstring.errors.txt deleted file mode 100644 index 875f3f168061b..0000000000000 --- a/tests/baselines/reference/importAttributesNonstring.errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -mod.mts(1,50): error TS2857: Import attribute values must be string literal expressions. -mod.mts(3,50): error TS2857: Import attribute values must be string literal expressions. -mod.mts(5,50): error TS2857: Import attribute values must be string literal expressions. -mod.mts(7,50): error TS2857: Import attribute values must be string literal expressions. -mod.mts(9,50): error TS2857: Import attribute values must be string literal expressions. -mod.mts(11,64): error TS2857: Import attribute values must be string literal expressions. - - -==== mod.mts (6 errors) ==== - import * as thing1 from "./mod.mjs" with {field: 0}; - ~ -!!! error TS2857: Import attribute values must be string literal expressions. - - import * as thing2 from "./mod.mjs" with {field: `a`}; - ~~~ -!!! error TS2857: Import attribute values must be string literal expressions. - - import * as thing3 from "./mod.mjs" with {field: /a/g}; - ~~~~ -!!! error TS2857: Import attribute values must be string literal expressions. - - import * as thing4 from "./mod.mjs" with {field: ["a"]}; - ~~~~~ -!!! error TS2857: Import attribute values must be string literal expressions. - - import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; - ~~~~~~~~ -!!! error TS2857: Import attribute values must be string literal expressions. - - import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} - ~~~~~~~~~~~~~ -!!! error TS2857: Import attribute values must be string literal expressions. \ No newline at end of file diff --git a/tests/baselines/reference/importAttributesNonstring.js b/tests/baselines/reference/importAttributesNonstring.js deleted file mode 100644 index 2685521b2a3ad..0000000000000 --- a/tests/baselines/reference/importAttributesNonstring.js +++ /dev/null @@ -1,17 +0,0 @@ -//// [tests/cases/compiler/importAttributesNonstring.ts] //// - -//// [mod.mts] -import * as thing1 from "./mod.mjs" with {field: 0}; - -import * as thing2 from "./mod.mjs" with {field: `a`}; - -import * as thing3 from "./mod.mjs" with {field: /a/g}; - -import * as thing4 from "./mod.mjs" with {field: ["a"]}; - -import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; - -import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} - -//// [mod.mjs] -export {}; diff --git a/tests/baselines/reference/importAttributesNonstring.symbols b/tests/baselines/reference/importAttributesNonstring.symbols deleted file mode 100644 index d69ce0675197a..0000000000000 --- a/tests/baselines/reference/importAttributesNonstring.symbols +++ /dev/null @@ -1,24 +0,0 @@ -//// [tests/cases/compiler/importAttributesNonstring.ts] //// - -=== mod.mts === -import * as thing1 from "./mod.mjs" with {field: 0}; ->thing1 : Symbol(thing1, Decl(mod.mts, 0, 6)) - -import * as thing2 from "./mod.mjs" with {field: `a`}; ->thing2 : Symbol(thing2, Decl(mod.mts, 2, 6)) - -import * as thing3 from "./mod.mjs" with {field: /a/g}; ->thing3 : Symbol(thing3, Decl(mod.mts, 4, 6)) - -import * as thing4 from "./mod.mjs" with {field: ["a"]}; ->thing4 : Symbol(thing4, Decl(mod.mts, 6, 6)) - -import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; ->thing5 : Symbol(thing5, Decl(mod.mts, 8, 6)) ->a : Symbol(a, Decl(mod.mts, 8, 50)) - -import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} ->thing6 : Symbol(thing6, Decl(mod.mts, 10, 6)) ->0..toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) ->toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) - diff --git a/tests/baselines/reference/importAttributesNonstring.types b/tests/baselines/reference/importAttributesNonstring.types deleted file mode 100644 index e8d29b46f6090..0000000000000 --- a/tests/baselines/reference/importAttributesNonstring.types +++ /dev/null @@ -1,38 +0,0 @@ -//// [tests/cases/compiler/importAttributesNonstring.ts] //// - -=== mod.mts === -import * as thing1 from "./mod.mjs" with {field: 0}; ->thing1 : typeof thing1 ->field : any - -import * as thing2 from "./mod.mjs" with {field: `a`}; ->thing2 : typeof thing1 ->field : any - -import * as thing3 from "./mod.mjs" with {field: /a/g}; ->thing3 : typeof thing1 ->field : any ->/a/g : RegExp - -import * as thing4 from "./mod.mjs" with {field: ["a"]}; ->thing4 : typeof thing1 ->field : any ->["a"] : string[] ->"a" : "a" - -import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; ->thing5 : typeof thing1 ->field : any ->{ a: 0 } : { a: number; } ->a : number ->0 : 0 - -import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} ->thing6 : typeof thing1 ->type : any ->field : any ->0..toString() : string ->0..toString : (radix?: number) => string ->0. : 0 ->toString : (radix?: number) => string - diff --git a/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.js b/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.js index fd213e286ea8f..9e56b828b58e0 100644 --- a/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.js +++ b/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.js @@ -157,8 +157,8 @@ export declare const e: typeof import("inner/mjs"); export declare const a: Promise<{ default: typeof import("./index.cjs"); }>; -export declare const b: Promise; -export declare const c: Promise; +export declare const b: Promise; +export declare const c: Promise; export declare const f: Promise<{ default: typeof import("inner"); cjsMain: true; @@ -168,4 +168,4 @@ export declare const d: Promise<{ default: typeof import("inner/cjs"); cjsNonmain: true; }>; -export declare const e: Promise; +export declare const e: Promise; diff --git a/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.types b/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.types index b7d8e6f8690f2..c4177bca3eb51 100644 --- a/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.types +++ b/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.types @@ -100,13 +100,13 @@ export const a = import("package/cjs"); >"package/cjs" : "package/cjs" export const b = import("package/mjs"); ->b : Promise ->import("package/mjs") : Promise +>b : Promise +>import("package/mjs") : Promise >"package/mjs" : "package/mjs" export const c = import("package"); ->c : Promise ->import("package") : Promise +>c : Promise +>import("package") : Promise >"package" : "package" export const f = import("inner"); @@ -122,8 +122,8 @@ export const d = import("inner/cjs"); >"inner/cjs" : "inner/cjs" export const e = import("inner/mjs"); ->e : Promise ->import("inner/mjs") : Promise +>e : Promise +>import("inner/mjs") : Promise >"inner/mjs" : "inner/mjs" === node_modules/inner/index.d.ts === diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt index 711ee31527328..55c25456e5507 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).errors.txt @@ -1,15 +1,11 @@ -/index.ts(2,15): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -/index.ts(11,15): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -==== /index.ts (5 errors) ==== +==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -25,8 +21,6 @@ export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).symbols b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).symbols index 0a1e523577f41..b2c93c67d55e4 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).symbols +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).symbols @@ -30,6 +30,10 @@ export type { RequireInterface } from "pkg" with { "resolution-mode": "require" export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + === /node_modules/pkg/require.d.ts === export interface RequireInterface {} >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).types b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).types index 26bf48ea1dcd7..cd1d81407b22a 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).types +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=node16).types @@ -5,7 +5,7 @@ import type { RequireInterface } from "pkg" with { "resolution-mode": "require" >RequireInterface : RequireInterface import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ->ImportInterface : any +>ImportInterface : ImportInterface export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -23,8 +23,11 @@ export type { RequireInterface } from "pkg" with { "resolution-mode": "require" >RequireInterface : RequireInterface export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ->ImportInterface : any +>ImportInterface : ImportInterface + +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} === /node_modules/pkg/require.d.ts === export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).errors.txt index ee68f3f155a82..961a363c1d556 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).errors.txt @@ -1,15 +1,11 @@ -/index.ts(2,15): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(6,50): error TS2855: Import attributes are not allowed on statements that transpile to CommonJS 'require' calls. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(7,49): error TS2855: Import attributes are not allowed on statements that transpile to CommonJS 'require' calls. -/index.ts(11,15): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -==== /index.ts (5 errors) ==== +==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -25,8 +21,6 @@ export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).symbols index 0a1e523577f41..b2c93c67d55e4 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).symbols +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).symbols @@ -30,6 +30,10 @@ export type { RequireInterface } from "pkg" with { "resolution-mode": "require" export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + === /node_modules/pkg/require.d.ts === export interface RequireInterface {} >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).types b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).types index 26bf48ea1dcd7..cd1d81407b22a 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).types +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit1(module=nodenext).types @@ -5,7 +5,7 @@ import type { RequireInterface } from "pkg" with { "resolution-mode": "require" >RequireInterface : RequireInterface import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ->ImportInterface : any +>ImportInterface : ImportInterface export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -23,8 +23,11 @@ export type { RequireInterface } from "pkg" with { "resolution-mode": "require" >RequireInterface : RequireInterface export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ->ImportInterface : any +>ImportInterface : ImportInterface + +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} === /node_modules/pkg/require.d.ts === export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt index 90dc175567add..8cb0099fe8ce0 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).errors.txt @@ -1,14 +1,10 @@ -/index.ts(1,15): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. /index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. /index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -/index.ts(10,15): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -==== /index.ts (5 errors) ==== +==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -24,8 +20,6 @@ export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ==== /node_modules/pkg/package.json (0 errors) ==== diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).symbols b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).symbols index d9714ec8de18c..d76777ff60b36 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).symbols +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).symbols @@ -34,3 +34,7 @@ export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface ImportInterface {} >ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).types b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).types index 7d22514ed32cf..5981886e84805 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).types +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=node16).types @@ -2,7 +2,7 @@ === /index.ts === import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; ->RequireInterface : any +>RequireInterface : RequireInterface import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface @@ -20,7 +20,7 @@ import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "impor export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; ->RequireInterface : any +>RequireInterface : RequireInterface export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface @@ -28,3 +28,6 @@ export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; === /node_modules/pkg/import.d.ts === export interface ImportInterface {} +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt index 4af71d98910e3..5c93150f88f13 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).errors.txt @@ -1,14 +1,10 @@ -/index.ts(1,15): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. /index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. /index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(10,15): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -==== /index.ts (5 errors) ==== +==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -24,8 +20,6 @@ export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ==== /node_modules/pkg/package.json (0 errors) ==== diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).symbols index d9714ec8de18c..d76777ff60b36 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).symbols +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).symbols @@ -34,3 +34,7 @@ export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface ImportInterface {} >ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) +=== /node_modules/pkg/require.d.ts === +export interface RequireInterface {} +>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).types b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).types index 7d22514ed32cf..5981886e84805 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).types +++ b/tests/baselines/reference/nodeModulesImportAttributesModeDeclarationEmit2(module=nodenext).types @@ -2,7 +2,7 @@ === /index.ts === import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; ->RequireInterface : any +>RequireInterface : RequireInterface import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface @@ -20,7 +20,7 @@ import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "impor export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; ->RequireInterface : any +>RequireInterface : RequireInterface export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface @@ -28,3 +28,6 @@ export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; === /node_modules/pkg/import.d.ts === export interface ImportInterface {} +=== /node_modules/pkg/require.d.ts === + +export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).errors.txt deleted file mode 100644 index 65d7adc33432d..0000000000000 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).errors.txt +++ /dev/null @@ -1,29 +0,0 @@ -/index.ts(3,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/index.ts(6,89): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - -==== /index.ts (2 errors) ==== - export type LocalInterface = - & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface - & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; - ~~~~~~~~~~~~~~~ -!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); - export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); - ~~~~~~~~~~~~~~~ -!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export interface ImportInterface {} -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).js b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).js index 7fa057ba55639..cca2ca8a8520a 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).js @@ -31,6 +31,6 @@ exports.b = null; //// [index.d.ts] -export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export type LocalInterface = import("pkg", { with: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: any; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).symbols b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).symbols index e3b90277a99cf..1f0e1652f5505 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).symbols +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).symbols @@ -8,6 +8,7 @@ export type LocalInterface = >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); >a : Symbol(a, Decl(index.ts, 4, 12)) @@ -15,6 +16,11 @@ export const a = (null as any as import("pkg", { with: {"resolution-mode": "requ export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); >b : Symbol(b, Decl(index.ts, 5, 12)) +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) === /node_modules/pkg/require.d.ts === export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).types b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).types index a809ebd5fbb37..a37c0c3191a79 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).types +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node16).types @@ -2,7 +2,7 @@ === /index.ts === export type LocalInterface = ->LocalInterface : any +>LocalInterface : import("/node_modules/pkg/require").RequireInterface & import("/node_modules/pkg/import").ImportInterface & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; @@ -14,11 +14,14 @@ export const a = (null as any as import("pkg", { with: {"resolution-mode": "requ >null as any : any export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); ->b : any ->(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : any ->null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : any +>b : import("/node_modules/pkg/import").ImportInterface +>(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : import("/node_modules/pkg/import").ImportInterface +>null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : import("/node_modules/pkg/import").ImportInterface >null as any : any +=== /node_modules/pkg/import.d.ts === + +export interface ImportInterface {} === /node_modules/pkg/require.d.ts === export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).errors.txt deleted file mode 100644 index 65d7adc33432d..0000000000000 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).errors.txt +++ /dev/null @@ -1,29 +0,0 @@ -/index.ts(3,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/index.ts(6,89): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - -==== /index.ts (2 errors) ==== - export type LocalInterface = - & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface - & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; - ~~~~~~~~~~~~~~~ -!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); - export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); - ~~~~~~~~~~~~~~~ -!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export interface ImportInterface {} -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).js b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).js index 7fa057ba55639..cca2ca8a8520a 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).js @@ -31,6 +31,6 @@ exports.b = null; //// [index.d.ts] -export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export type LocalInterface = import("pkg", { with: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: any; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).symbols index e3b90277a99cf..1f0e1652f5505 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).symbols +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).symbols @@ -8,6 +8,7 @@ export type LocalInterface = >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); >a : Symbol(a, Decl(index.ts, 4, 12)) @@ -15,6 +16,11 @@ export const a = (null as any as import("pkg", { with: {"resolution-mode": "requ export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); >b : Symbol(b, Decl(index.ts, 5, 12)) +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) === /node_modules/pkg/require.d.ts === export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).types b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).types index a809ebd5fbb37..a37c0c3191a79 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).types +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmit(module=nodenext).types @@ -2,7 +2,7 @@ === /index.ts === export type LocalInterface = ->LocalInterface : any +>LocalInterface : import("/node_modules/pkg/require").RequireInterface & import("/node_modules/pkg/import").ImportInterface & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; @@ -14,11 +14,14 @@ export const a = (null as any as import("pkg", { with: {"resolution-mode": "requ >null as any : any export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); ->b : any ->(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : any ->null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : any +>b : import("/node_modules/pkg/import").ImportInterface +>(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : import("/node_modules/pkg/import").ImportInterface +>null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : import("/node_modules/pkg/import").ImportInterface >null as any : any +=== /node_modules/pkg/import.d.ts === + +export interface ImportInterface {} === /node_modules/pkg/require.d.ts === export interface RequireInterface {} diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt index 1ca93a8a5144e..b6de1111e72aa 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt @@ -1,8 +1,6 @@ error TS2468: Cannot find global value 'Promise'. /index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(3,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. /index.ts(5,76): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(6,89): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(3,22): error TS1005: 'with' expected. /other.ts(3,39): error TS1005: ';' expected. @@ -97,21 +95,17 @@ error TS2468: Cannot find global value 'Promise'. ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (4 errors) ==== +==== /index.ts (2 errors) ==== export type LocalInterface = & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; - ~~~~~~~~~~~~~~~ -!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); - ~~~~~~~~~~~~~~~ -!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. ==== /other.ts (28 errors) ==== // missing with: diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).js b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).js index 2eca0abaed21b..63b333fded12a 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).js @@ -126,28 +126,28 @@ exports.b = null; //// [index.d.ts] -export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export type LocalInterface = import("pkg", { with: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: any; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] -export type LocalInterface = import("pkg"); +export type LocalInterface = import("pkg", { with: {} }); export declare const a: any; export declare const b: any; //// [other2.d.ts] -export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export type LocalInterface = import("pkg", { with: { "bad": "require" } }).RequireInterface & import("pkg", { with: { "bad": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other3.d.ts] -export type LocalInterface = import("pkg")[{ +export type LocalInterface = import("pkg", { with: {} })[{ "resolution-mode": "require"; }]; export declare const a: any; export declare const b: any; //// [other4.d.ts] -export type LocalInterface = import("pkg"); +export type LocalInterface = import("pkg", { with: {} }); export declare const a: any, Attribute1: any, RequireInterface: any; export declare const b: any, Attribute2: any, ImportInterface: any; //// [other5.d.ts] -export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export type LocalInterface = import("pkg", { with: {} }).RequireInterface & import("pkg", { with: {} }).ImportInterface; export declare const a: import("pkg").RequireInterface; export declare const b: any; diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).symbols b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).symbols index 90a6afc84dd11..8a23a85dd4673 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).symbols +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).symbols @@ -16,6 +16,7 @@ export type LocalInterface = >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); >a : Symbol(a, Decl(index.ts, 4, 12)) @@ -23,6 +24,7 @@ export const a = (null as any as import("pkg", { with: {"resolution-mode": "foob export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); >b : Symbol(b, Decl(index.ts, 5, 12)) +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) === /other.ts === // missing with: diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).types b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).types index 8f160430a96c3..fb98c821d00cd 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).types +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).types @@ -10,7 +10,7 @@ export interface RequireInterface {} === /index.ts === export type LocalInterface = ->LocalInterface : any +>LocalInterface : import("/node_modules/pkg/require").RequireInterface & import("/node_modules/pkg/import").ImportInterface & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; @@ -22,9 +22,9 @@ export const a = (null as any as import("pkg", { with: {"resolution-mode": "foob >null as any : any export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); ->b : any ->(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : any ->null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : any +>b : import("/node_modules/pkg/import").ImportInterface +>(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : import("/node_modules/pkg/import").ImportInterface +>null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : import("/node_modules/pkg/import").ImportInterface >null as any : any === /other.ts === diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt index 1ca93a8a5144e..b6de1111e72aa 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt @@ -1,8 +1,6 @@ error TS2468: Cannot find global value 'Promise'. /index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(3,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. /index.ts(5,76): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(6,89): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(3,22): error TS1005: 'with' expected. /other.ts(3,39): error TS1005: ';' expected. @@ -97,21 +95,17 @@ error TS2468: Cannot find global value 'Promise'. ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (4 errors) ==== +==== /index.ts (2 errors) ==== export type LocalInterface = & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; - ~~~~~~~~~~~~~~~ -!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); - ~~~~~~~~~~~~~~~ -!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. ==== /other.ts (28 errors) ==== // missing with: diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).js b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).js index 2eca0abaed21b..63b333fded12a 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).js @@ -126,28 +126,28 @@ exports.b = null; //// [index.d.ts] -export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export type LocalInterface = import("pkg", { with: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: any; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] -export type LocalInterface = import("pkg"); +export type LocalInterface = import("pkg", { with: {} }); export declare const a: any; export declare const b: any; //// [other2.d.ts] -export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export type LocalInterface = import("pkg", { with: { "bad": "require" } }).RequireInterface & import("pkg", { with: { "bad": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other3.d.ts] -export type LocalInterface = import("pkg")[{ +export type LocalInterface = import("pkg", { with: {} })[{ "resolution-mode": "require"; }]; export declare const a: any; export declare const b: any; //// [other4.d.ts] -export type LocalInterface = import("pkg"); +export type LocalInterface = import("pkg", { with: {} }); export declare const a: any, Attribute1: any, RequireInterface: any; export declare const b: any, Attribute2: any, ImportInterface: any; //// [other5.d.ts] -export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export type LocalInterface = import("pkg", { with: {} }).RequireInterface & import("pkg", { with: {} }).ImportInterface; export declare const a: import("pkg").RequireInterface; export declare const b: any; diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).symbols index 90a6afc84dd11..8a23a85dd4673 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).symbols +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).symbols @@ -16,6 +16,7 @@ export type LocalInterface = >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) export const a = (null as any as import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface); >a : Symbol(a, Decl(index.ts, 4, 12)) @@ -23,6 +24,7 @@ export const a = (null as any as import("pkg", { with: {"resolution-mode": "foob export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); >b : Symbol(b, Decl(index.ts, 5, 12)) +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) === /other.ts === // missing with: diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).types b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).types index 8f160430a96c3..fb98c821d00cd 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).types +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).types @@ -10,7 +10,7 @@ export interface RequireInterface {} === /index.ts === export type LocalInterface = ->LocalInterface : any +>LocalInterface : import("/node_modules/pkg/require").RequireInterface & import("/node_modules/pkg/import").ImportInterface & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; @@ -22,9 +22,9 @@ export const a = (null as any as import("pkg", { with: {"resolution-mode": "foob >null as any : any export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); ->b : any ->(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : any ->null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : any +>b : import("/node_modules/pkg/import").ImportInterface +>(null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface) : import("/node_modules/pkg/import").ImportInterface +>null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface : import("/node_modules/pkg/import").ImportInterface >null as any : any === /other.ts === diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js index 972ed5f68fdbb..6c0a3531fac79 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js @@ -33,32 +33,4 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: import("pkg").ImportInterface; - - -//// [DtsFileErrors] - - -out/index.d.ts(3,39): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - -==== out/index.d.ts (1 errors) ==== - export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; - export declare const a: import("pkg").RequireInterface; - export declare const b: import("pkg").ImportInterface; - ~~~~~~~~~~~~~~~ -!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export interface ImportInterface {} -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} \ No newline at end of file +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js index 972ed5f68fdbb..6c0a3531fac79 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js @@ -33,32 +33,4 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: import("pkg").ImportInterface; - - -//// [DtsFileErrors] - - -out/index.d.ts(3,39): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - -==== out/index.d.ts (1 errors) ==== - export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; - export declare const a: import("pkg").RequireInterface; - export declare const b: import("pkg").ImportInterface; - ~~~~~~~~~~~~~~~ -!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export interface ImportInterface {} -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} \ No newline at end of file +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js index 45a682b5c892e..061f57d2e62c7 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js @@ -122,9 +122,9 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: import("pkg").ImportInterface; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] -export type LocalInterface = import("pkg"); +export type LocalInterface = import("pkg", { with: {} }); export declare const a: any; export declare const b: any; //// [other2.d.ts] @@ -132,13 +132,13 @@ export type LocalInterface = import("pkg", { assert: { "bad": "require" } }).Req export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other3.d.ts] -export type LocalInterface = import("pkg")[{ +export type LocalInterface = import("pkg", { with: {} })[{ "resolution-mode": "require"; }]; export declare const a: any; export declare const b: any; //// [other4.d.ts] -export type LocalInterface = import("pkg"); +export type LocalInterface = import("pkg", { with: {} }); export declare const a: any, Asserts1: any, RequireInterface: any; export declare const b: any, Asserts2: any, ImportInterface: any; //// [other5.d.ts] diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js index 45a682b5c892e..061f57d2e62c7 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js @@ -122,9 +122,9 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: import("pkg").ImportInterface; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] -export type LocalInterface = import("pkg"); +export type LocalInterface = import("pkg", { with: {} }); export declare const a: any; export declare const b: any; //// [other2.d.ts] @@ -132,13 +132,13 @@ export type LocalInterface = import("pkg", { assert: { "bad": "require" } }).Req export declare const a: import("pkg").RequireInterface; export declare const b: any; //// [other3.d.ts] -export type LocalInterface = import("pkg")[{ +export type LocalInterface = import("pkg", { with: {} })[{ "resolution-mode": "require"; }]; export declare const a: any; export declare const b: any; //// [other4.d.ts] -export type LocalInterface = import("pkg"); +export type LocalInterface = import("pkg", { with: {} }); export declare const a: any, Asserts1: any, RequireInterface: any; export declare const b: any, Asserts2: any, ImportInterface: any; //// [other5.d.ts] diff --git a/tests/baselines/reference/tscWatch/moduleResolution/module-resolutions-from-files-with-partially-used-import-attributes.js b/tests/baselines/reference/tscWatch/moduleResolution/module-resolutions-from-files-with-partially-used-import-attributes.js index 6516433995b3e..3315ea948b505 100644 --- a/tests/baselines/reference/tscWatch/moduleResolution/module-resolutions-from-files-with-partially-used-import-attributes.js +++ b/tests/baselines/reference/tscWatch/moduleResolution/module-resolutions-from-files-with-partially-used-import-attributes.js @@ -59,7 +59,7 @@ File '/user/package.json' does not exist according to earlier cached lookups. File '/package.json' does not exist according to earlier cached lookups. ======== Resolving module 'pkg' from '/user/username/projects/myproject/index.ts'. ======== Explicitly specified module resolution kind: 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. File '/user/username/projects/package.json' does not exist according to earlier cached lookups. File '/user/username/package.json' does not exist according to earlier cached lookups. @@ -69,17 +69,16 @@ Loading module 'pkg' from 'node_modules' folder, target file types: TypeScript, Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. Found 'package.json' at '/user/username/projects/myproject/node_modules/pkg/package.json'. Entering conditional exports. -Saw non-matching condition 'import'. -Matched 'exports' condition 'require'. -Using 'exports' subpath '.' with target './require.js'. -File name '/user/username/projects/myproject/node_modules/pkg/require.js' has a '.js' extension - stripping it. -File '/user/username/projects/myproject/node_modules/pkg/require.ts' does not exist. -File '/user/username/projects/myproject/node_modules/pkg/require.tsx' does not exist. -File '/user/username/projects/myproject/node_modules/pkg/require.d.ts' exists - use it as a name resolution result. -Resolved under condition 'require'. +Matched 'exports' condition 'import'. +Using 'exports' subpath '.' with target './import.js'. +File name '/user/username/projects/myproject/node_modules/pkg/import.js' has a '.js' extension - stripping it. +File '/user/username/projects/myproject/node_modules/pkg/import.ts' does not exist. +File '/user/username/projects/myproject/node_modules/pkg/import.tsx' does not exist. +File '/user/username/projects/myproject/node_modules/pkg/import.d.ts' exists - use it as a name resolution result. +Resolved under condition 'import'. Exiting conditional exports. -Resolving real path for '/user/username/projects/myproject/node_modules/pkg/require.d.ts', result '/user/username/projects/myproject/node_modules/pkg/require.d.ts'. -======== Module name 'pkg' was successfully resolved to '/user/username/projects/myproject/node_modules/pkg/require.d.ts' with Package ID 'pkg/require.d.ts@0.0.1'. ======== +Resolving real path for '/user/username/projects/myproject/node_modules/pkg/import.d.ts', result '/user/username/projects/myproject/node_modules/pkg/import.d.ts'. +======== Module name 'pkg' was successfully resolved to '/user/username/projects/myproject/node_modules/pkg/import.d.ts' with Package ID 'pkg/import.d.ts@0.0.1'. ======== ======== Resolving module 'pkg1' from '/user/username/projects/myproject/index.ts'. ======== Explicitly specified module resolution kind: 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. @@ -144,7 +143,7 @@ Program structureReused: Not Program files:: /a/lib/lib.d.ts /user/username/projects/myproject/a.ts -/user/username/projects/myproject/node_modules/pkg/require.d.ts +/user/username/projects/myproject/node_modules/pkg/import.d.ts /user/username/projects/myproject/index.ts No cached semantic diagnostics in the builder:: @@ -152,7 +151,7 @@ No cached semantic diagnostics in the builder:: Shape signatures in builder refreshed for:: /a/lib/lib.d.ts (used version) /user/username/projects/myproject/a.ts (used version) -/user/username/projects/myproject/node_modules/pkg/require.d.ts (used version) +/user/username/projects/myproject/node_modules/pkg/import.d.ts (used version) /user/username/projects/myproject/index.ts (used version) PolledWatches:: @@ -178,9 +177,9 @@ FsWatches:: {} /user/username/projects/myproject/index.ts: *new* {} -/user/username/projects/myproject/node_modules/pkg/package.json: *new* +/user/username/projects/myproject/node_modules/pkg/import.d.ts: *new* {} -/user/username/projects/myproject/node_modules/pkg/require.d.ts: *new* +/user/username/projects/myproject/node_modules/pkg/package.json: *new* {} /user/username/projects/myproject/node_modules/pkg1/package.json: *new* {} @@ -244,7 +243,7 @@ File '/user/package.json' does not exist according to earlier cached lookups. File '/package.json' does not exist according to earlier cached lookups. ======== Resolving module 'pkg' from '/user/username/projects/myproject/a.ts'. ======== Explicitly specified module resolution kind: 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. File '/user/username/projects/package.json' does not exist according to earlier cached lookups. File '/user/username/package.json' does not exist according to earlier cached lookups. @@ -254,24 +253,23 @@ Loading module 'pkg' from 'node_modules' folder, target file types: TypeScript, Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/user/username/projects/myproject/node_modules/pkg/package.json' exists according to earlier cached lookups. Entering conditional exports. -Saw non-matching condition 'import'. -Matched 'exports' condition 'require'. -Using 'exports' subpath '.' with target './require.js'. -File name '/user/username/projects/myproject/node_modules/pkg/require.js' has a '.js' extension - stripping it. -File '/user/username/projects/myproject/node_modules/pkg/require.ts' does not exist. -File '/user/username/projects/myproject/node_modules/pkg/require.tsx' does not exist. -File '/user/username/projects/myproject/node_modules/pkg/require.d.ts' exists - use it as a name resolution result. -Resolved under condition 'require'. +Matched 'exports' condition 'import'. +Using 'exports' subpath '.' with target './import.js'. +File name '/user/username/projects/myproject/node_modules/pkg/import.js' has a '.js' extension - stripping it. +File '/user/username/projects/myproject/node_modules/pkg/import.ts' does not exist. +File '/user/username/projects/myproject/node_modules/pkg/import.tsx' does not exist. +File '/user/username/projects/myproject/node_modules/pkg/import.d.ts' exists - use it as a name resolution result. +Resolved under condition 'import'. Exiting conditional exports. -Resolving real path for '/user/username/projects/myproject/node_modules/pkg/require.d.ts', result '/user/username/projects/myproject/node_modules/pkg/require.d.ts'. -======== Module name 'pkg' was successfully resolved to '/user/username/projects/myproject/node_modules/pkg/require.d.ts' with Package ID 'pkg/require.d.ts@0.0.1'. ======== +Resolving real path for '/user/username/projects/myproject/node_modules/pkg/import.d.ts', result '/user/username/projects/myproject/node_modules/pkg/import.d.ts'. +======== Module name 'pkg' was successfully resolved to '/user/username/projects/myproject/node_modules/pkg/import.d.ts' with Package ID 'pkg/import.d.ts@0.0.1'. ======== File '/user/username/projects/myproject/node_modules/pkg/package.json' exists according to earlier cached lookups. File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. File '/user/username/projects/package.json' does not exist according to earlier cached lookups. File '/user/username/package.json' does not exist according to earlier cached lookups. File '/user/package.json' does not exist according to earlier cached lookups. File '/package.json' does not exist according to earlier cached lookups. -Reusing resolution of module 'pkg' from '/user/username/projects/myproject/index.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/node_modules/pkg/require.d.ts' with Package ID 'pkg/require.d.ts@0.0.1'. +Reusing resolution of module 'pkg' from '/user/username/projects/myproject/index.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/node_modules/pkg/import.d.ts' with Package ID 'pkg/import.d.ts@0.0.1'. Reusing resolution of module './a' from '/user/username/projects/myproject/index.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/a.ts'. Reusing resolution of module 'pkg1' from '/user/username/projects/myproject/index.ts' of old program, it was not resolved. File '/a/lib/package.json' does not exist according to earlier cached lookups. @@ -288,7 +286,7 @@ Program options: {"moduleResolution":3,"watch":true,"traceResolution":true,"conf Program structureReused: SafeModules Program files:: /a/lib/lib.d.ts -/user/username/projects/myproject/node_modules/pkg/require.d.ts +/user/username/projects/myproject/node_modules/pkg/import.d.ts /user/username/projects/myproject/a.ts /user/username/projects/myproject/index.ts diff --git a/tests/cases/compiler/importAttributesNonstring.ts b/tests/cases/compiler/importAttributesNonstring.ts deleted file mode 100644 index b904ea398b95d..0000000000000 --- a/tests/cases/compiler/importAttributesNonstring.ts +++ /dev/null @@ -1,13 +0,0 @@ -// @module: nodenext -// @filename: mod.mts -import * as thing1 from "./mod.mjs" with {field: 0}; - -import * as thing2 from "./mod.mjs" with {field: `a`}; - -import * as thing3 from "./mod.mjs" with {field: /a/g}; - -import * as thing4 from "./mod.mjs" with {field: ["a"]}; - -import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; - -import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} \ No newline at end of file diff --git a/tests/cases/conformance/importAttributes/importAttributes6.ts b/tests/cases/conformance/importAttributes/importAttributes6.ts index d76afe8699e3f..c23f2ef5a27e9 100644 --- a/tests/cases/conformance/importAttributes/importAttributes6.ts +++ b/tests/cases/conformance/importAttributes/importAttributes6.ts @@ -1,8 +1,8 @@ // @module: nodenext // @filename: mod.mts -import * as thing1 from "./mod.mjs" with {field: 0}; -import * as thing2 from "./mod.mjs" with {field: `a`}; -import * as thing3 from "./mod.mjs" with {field: /a/g}; -import * as thing4 from "./mod.mjs" with {field: ["a"]}; -import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; -import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} +import * as thing1 from "./mod.mjs" with { field: 0 }; +import * as thing2 from "./mod.mjs" with { field: `a` }; +import * as thing3 from "./mod.mjs" with { field: /a/g }; +import * as thing4 from "./mod.mjs" with { field: ["a"] }; +import * as thing5 from "./mod.mjs" with { field: { a: 0 } }; +import * as thing6 from "./mod.mjs" with { type: "json", field: 0..toString() }; From fc2093c141f546c99575276ab94d2817e237f9db Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Sat, 26 Aug 2023 23:26:31 +0300 Subject: [PATCH 06/21] update baseline --- tests/baselines/reference/parseImportAttributesError.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/baselines/reference/parseImportAttributesError.js b/tests/baselines/reference/parseImportAttributesError.js index f5ecf476926ff..e0596a83f2d66 100644 --- a/tests/baselines/reference/parseImportAttributesError.js +++ b/tests/baselines/reference/parseImportAttributesError.js @@ -34,6 +34,6 @@ exports.b = null; //// [index.d.ts] -export type LocalInterface = import("pkg").RequireInterface & import("pkg").ImportInterface; +export type LocalInterface = import("pkg", { with: { 1234: , "resolution-mode": "require" } }).RequireInterface & import("pkg", { with: { 1234: , "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; export declare const b: any; From 4a16bf253bcdfab7805c5ff0d4a6706094d2014d Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Wed, 30 Aug 2023 00:28:41 +0300 Subject: [PATCH 07/21] add deprecation diagnostic message --- src/compiler/checker.ts | 3 ++ ...portAssertion1(module=commonjs).errors.txt | 19 +++++++++-- ...importAssertion1(module=es2015).errors.txt | 19 +++++++++-- ...importAssertion1(module=esnext).errors.txt | 19 +++++++++-- ...portAssertion2(module=commonjs).errors.txt | 22 ++++++++++-- ...importAssertion2(module=es2015).errors.txt | 22 ++++++++++-- ...importAssertion2(module=esnext).errors.txt | 34 +++++++++++++++++++ .../importAssertion2(module=esnext).types | 14 ++++---- ...importAssertion3(module=es2015).errors.txt | 16 +++++++-- ...importAssertion3(module=esnext).errors.txt | 16 +++++++-- .../importAssertionNonstring.errors.txt | 20 ++++++++++- 11 files changed, 182 insertions(+), 22 deletions(-) create mode 100644 tests/baselines/reference/importAssertion2(module=esnext).errors.txt diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ae219f82ef00d..edf64d71cc275 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -45057,6 +45057,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function checkImportAttributes(declaration: ImportDeclaration | ExportDeclaration) { + if (declaration.assertClause) { + grammarErrorOnFirstToken(declaration.assertClause, Diagnostics.The_assert_keyword_in_import_attributes_is_deprecated_and_it_has_been_replaced_by_the_with_keyword); + } const node = declaration.attributes || declaration.assertClause; if (node) { const validForTypeAttributes = isExclusivelyTypeOnlyImportOrExport(declaration); diff --git a/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt b/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt index c937b51391439..8e88dbb705ee6 100644 --- a/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt @@ -1,7 +1,12 @@ +1.ts(1,14): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(3,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. 3.ts(2,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. 3.ts(3,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. @@ -18,14 +23,20 @@ export const a = 1; export const b = 2; -==== 1.ts (3 errors) ==== +==== 1.ts (6 errors) ==== import './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import { a, b } from './0' assert { "type": "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import * as foo from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. a; @@ -33,11 +44,15 @@ foo.a; foo.b; -==== 2.ts (2 errors) ==== +==== 2.ts (4 errors) ==== import { a, b } from './0' assert {} + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. a; diff --git a/tests/baselines/reference/importAssertion1(module=es2015).errors.txt b/tests/baselines/reference/importAssertion1(module=es2015).errors.txt index 44aeede5b994c..04af372ea2e50 100644 --- a/tests/baselines/reference/importAssertion1(module=es2015).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=es2015).errors.txt @@ -1,7 +1,12 @@ +1.ts(1,14): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(3,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. 3.ts(1,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. 3.ts(2,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. @@ -18,14 +23,20 @@ export const a = 1; export const b = 2; -==== 1.ts (3 errors) ==== +==== 1.ts (6 errors) ==== import './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import { a, b } from './0' assert { "type": "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import * as foo from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. a; @@ -33,11 +44,15 @@ foo.a; foo.b; -==== 2.ts (2 errors) ==== +==== 2.ts (4 errors) ==== import { a, b } from './0' assert {} + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. a; diff --git a/tests/baselines/reference/importAssertion1(module=esnext).errors.txt b/tests/baselines/reference/importAssertion1(module=esnext).errors.txt index e8100730813c4..a861bded301a5 100644 --- a/tests/baselines/reference/importAssertion1(module=esnext).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=esnext).errors.txt @@ -1,3 +1,8 @@ +1.ts(1,14): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(3,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 3.ts(8,11): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments 3.ts(9,11): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments @@ -6,18 +11,28 @@ export const a = 1; export const b = 2; -==== 1.ts (0 errors) ==== +==== 1.ts (3 errors) ==== import './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. import { a, b } from './0' assert { "type": "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. import * as foo from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. a; b; foo.a; foo.b; -==== 2.ts (0 errors) ==== +==== 2.ts (2 errors) ==== import { a, b } from './0' assert {} + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. a; b; c; diff --git a/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt b/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt index e902dce6562c6..193ad948653cb 100644 --- a/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt +++ b/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt @@ -1,8 +1,14 @@ +1.ts(1,22): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(1,22): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(3,21): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(4,27): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. @@ -10,25 +16,37 @@ export const a = 1; export const b = 2; -==== 1.ts (4 errors) ==== +==== 1.ts (8 errors) ==== export {} from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export { a, b } from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export * from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export * as ns from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -==== 2.ts (2 errors) ==== +==== 2.ts (4 errors) ==== export { a, b } from './0' assert {} + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion2(module=es2015).errors.txt b/tests/baselines/reference/importAssertion2(module=es2015).errors.txt index e902dce6562c6..193ad948653cb 100644 --- a/tests/baselines/reference/importAssertion2(module=es2015).errors.txt +++ b/tests/baselines/reference/importAssertion2(module=es2015).errors.txt @@ -1,8 +1,14 @@ +1.ts(1,22): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(1,22): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(3,21): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(4,27): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. @@ -10,25 +16,37 @@ export const a = 1; export const b = 2; -==== 1.ts (4 errors) ==== +==== 1.ts (8 errors) ==== export {} from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export { a, b } from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export * from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export * as ns from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -==== 2.ts (2 errors) ==== +==== 2.ts (4 errors) ==== export { a, b } from './0' assert {} + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion2(module=esnext).errors.txt b/tests/baselines/reference/importAssertion2(module=esnext).errors.txt new file mode 100644 index 0000000000000..e05f06666e93a --- /dev/null +++ b/tests/baselines/reference/importAssertion2(module=esnext).errors.txt @@ -0,0 +1,34 @@ +1.ts(1,22): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(3,21): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(4,27): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. + + +==== 0.ts (0 errors) ==== + export const a = 1; + export const b = 2; + +==== 1.ts (4 errors) ==== + export {} from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. + export { a, b } from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. + export * from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. + export * as ns from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. + +==== 2.ts (2 errors) ==== + export { a, b } from './0' assert {} + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. + export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. + \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion2(module=esnext).types b/tests/baselines/reference/importAssertion2(module=esnext).types index 6d17f2a988e8c..f917bb2b1e47d 100644 --- a/tests/baselines/reference/importAssertion2(module=esnext).types +++ b/tests/baselines/reference/importAssertion2(module=esnext).types @@ -11,19 +11,19 @@ export const b = 2; === 1.ts === export {} from './0' assert { type: "json" } ->type : error +>type : any export { a, b } from './0' assert { type: "json" } >a : 1 >b : 2 ->type : error +>type : any export * from './0' assert { type: "json" } ->type : error +>type : any export * as ns from './0' assert { type: "json" } >ns : typeof import("0") ->type : error +>type : any === 2.ts === export { a, b } from './0' assert {} @@ -35,7 +35,7 @@ export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } >c : 1 >b : 2 >d : 2 ->a : error ->b : error ->c : error +>a : any +>b : any +>c : any diff --git a/tests/baselines/reference/importAssertion3(module=es2015).errors.txt b/tests/baselines/reference/importAssertion3(module=es2015).errors.txt index 05054102cd71a..861c09db5d4b1 100644 --- a/tests/baselines/reference/importAssertion3(module=es2015).errors.txt +++ b/tests/baselines/reference/importAssertion3(module=es2015).errors.txt @@ -1,25 +1,37 @@ +1.ts(1,27): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(1,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +1.ts(2,30): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(2,30): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(1,31): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 2.ts(1,31): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +2.ts(2,33): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 2.ts(2,33): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ==== 0.ts (0 errors) ==== export interface I { } -==== 1.ts (2 errors) ==== +==== 1.ts (4 errors) ==== export type {} from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export type { I } from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -==== 2.ts (2 errors) ==== +==== 2.ts (4 errors) ==== import type { I } from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import type * as foo from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. diff --git a/tests/baselines/reference/importAssertion3(module=esnext).errors.txt b/tests/baselines/reference/importAssertion3(module=esnext).errors.txt index 1d754165a3df6..98f87a6248ab1 100644 --- a/tests/baselines/reference/importAssertion3(module=esnext).errors.txt +++ b/tests/baselines/reference/importAssertion3(module=esnext).errors.txt @@ -1,25 +1,37 @@ +1.ts(1,27): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(1,27): error TS2822: Import assertions cannot be used with type-only imports or exports. +1.ts(2,30): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 1.ts(2,30): error TS2822: Import assertions cannot be used with type-only imports or exports. +2.ts(1,31): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 2.ts(1,31): error TS2822: Import assertions cannot be used with type-only imports or exports. +2.ts(2,33): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. 2.ts(2,33): error TS2822: Import assertions cannot be used with type-only imports or exports. ==== 0.ts (0 errors) ==== export interface I { } -==== 1.ts (2 errors) ==== +==== 1.ts (4 errors) ==== export type {} from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2822: Import assertions cannot be used with type-only imports or exports. export type { I } from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2822: Import assertions cannot be used with type-only imports or exports. -==== 2.ts (2 errors) ==== +==== 2.ts (4 errors) ==== import type { I } from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2822: Import assertions cannot be used with type-only imports or exports. import type * as foo from './0' assert { type: "json" } + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2822: Import assertions cannot be used with type-only imports or exports. diff --git a/tests/baselines/reference/importAssertionNonstring.errors.txt b/tests/baselines/reference/importAssertionNonstring.errors.txt index bb55e2a13bc1d..378669e4be284 100644 --- a/tests/baselines/reference/importAssertionNonstring.errors.txt +++ b/tests/baselines/reference/importAssertionNonstring.errors.txt @@ -1,32 +1,50 @@ +mod.mts(1,37): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. mod.mts(1,52): error TS2837: Import assertion values must be string literal expressions. +mod.mts(3,37): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. mod.mts(3,52): error TS2837: Import assertion values must be string literal expressions. +mod.mts(5,37): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. mod.mts(5,52): error TS2837: Import assertion values must be string literal expressions. +mod.mts(7,37): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. mod.mts(7,52): error TS2837: Import assertion values must be string literal expressions. +mod.mts(9,37): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. mod.mts(9,52): error TS2837: Import assertion values must be string literal expressions. +mod.mts(11,37): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. mod.mts(11,66): error TS2837: Import assertion values must be string literal expressions. -==== mod.mts (6 errors) ==== +==== mod.mts (12 errors) ==== import * as thing1 from "./mod.mjs" assert {field: 0}; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing2 from "./mod.mjs" assert {field: `a`}; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing3 from "./mod.mjs" assert {field: /a/g}; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing4 from "./mod.mjs" assert {field: ["a"]}; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing5 from "./mod.mjs" assert {field: { a: 0 }}; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing6 from "./mod.mjs" assert {type: "json", field: 0..toString()} + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~ !!! error TS2837: Import assertion values must be string literal expressions. \ No newline at end of file From dbd7eb545783e9ab0f64b02df4d2bc0c3151891a Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Wed, 30 Aug 2023 00:43:22 +0300 Subject: [PATCH 08/21] update baseline --- ...ImportAssertions(module=node16).errors.txt | 10 ++++++++-- ...portAssertions(module=nodenext).errors.txt | 10 ++++++++-- ...DeclarationEmit1(module=node16).errors.txt | 20 ++++++++++++++++++- ...clarationEmit1(module=nodenext).errors.txt | 20 ++++++++++++++++++- ...DeclarationEmit2(module=node16).errors.txt | 20 ++++++++++++++++++- ...clarationEmit2(module=nodenext).errors.txt | 20 ++++++++++++++++++- ...ationEmitErrors1(module=node16).errors.txt | 11 +++++++++- ...ionEmitErrors1(module=nodenext).errors.txt | 11 +++++++++- 8 files changed, 112 insertions(+), 10 deletions(-) diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt index 9aec13e27c5a5..9358d3e99bf21 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt @@ -1,16 +1,22 @@ error TS2468: Cannot find global value 'Promise'. +index.ts(1,35): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. index.ts(1,35): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +otherc.cts(1,35): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. otherc.cts(1,35): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. otherc.cts(2,15): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. !!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (1 errors) ==== +==== index.ts (2 errors) ==== import json from "./package.json" assert { type: "json" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -==== otherc.cts (2 errors) ==== +==== otherc.cts (3 errors) ==== import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).errors.txt index 19217bd404ddb..ed6626bfc4ea0 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).errors.txt @@ -1,13 +1,19 @@ error TS2468: Cannot find global value 'Promise'. +index.ts(1,35): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +otherc.cts(1,35): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. otherc.cts(1,35): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. otherc.cts(2,15): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. !!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (0 errors) ==== +==== index.ts (1 errors) ==== import json from "./package.json" assert { type: "json" }; -==== otherc.cts (2 errors) ==== + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +==== otherc.cts (3 errors) ==== import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt index a8a76a05152b7..17bdeae24d156 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt @@ -1,26 +1,44 @@ +/index.ts(1,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(2,44): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(6,50): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. /index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. +/index.ts(7,49): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. /index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +/index.ts(10,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(11,44): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -==== /index.ts (3 errors) ==== +==== /index.ts (9 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt index dd57016e6b7d1..67c44cad05803 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt @@ -1,26 +1,44 @@ +/index.ts(1,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(2,44): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(6,50): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. /index.ts(6,50): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. +/index.ts(7,49): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. /index.ts(7,49): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. +/index.ts(10,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(11,44): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -==== /index.ts (3 errors) ==== +==== /index.ts (9 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt index 0403a6e026ffe..ddae949b7eee9 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt @@ -1,26 +1,44 @@ +/index.ts(1,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(2,44): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. +/index.ts(6,50): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. /index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +/index.ts(7,49): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. /index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +/index.ts(10,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(11,44): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -==== /index.ts (3 errors) ==== +==== /index.ts (9 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt index 47c2ad040c0db..e9eaec3599d71 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt @@ -1,26 +1,44 @@ +/index.ts(1,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(2,44): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. +/index.ts(6,50): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. /index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(7,49): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. /index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(10,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(11,44): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -==== /index.ts (3 errors) ==== +==== /index.ts (9 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1454: `resolution-mode` can only be set for type-only imports. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1454: `resolution-mode` can only be set for type-only imports. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt index bc3eb30565c6f..62fd5941c7d42 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt @@ -1,13 +1,18 @@ +/index.ts(2,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. /index.ts(2,45): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. +/index.ts(4,39): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. /index.ts(4,39): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +/index.ts(6,76): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. /index.ts(6,76): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -==== /index.ts (5 errors) ==== +==== /index.ts (8 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ~~~~~~~~ @@ -16,10 +21,14 @@ import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt index 98a0b7fcfa6f7..3fded26eb8f2b 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt @@ -1,13 +1,18 @@ +/index.ts(2,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. /index.ts(2,45): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. +/index.ts(4,39): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. /index.ts(4,39): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. +/index.ts(6,76): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. /index.ts(6,76): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. -==== /index.ts (5 errors) ==== +==== /index.ts (8 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. ~~~~~~~~ @@ -16,10 +21,14 @@ import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~ +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. From bebf68769ec7e5e72dc9da3331e7919b3d23fca9 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Tue, 12 Sep 2023 22:22:44 +0300 Subject: [PATCH 09/21] update diagnostic message --- src/compiler/checker.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- ...portAssertion1(module=commonjs).errors.txt | 20 ++++++++-------- ...importAssertion1(module=es2015).errors.txt | 20 ++++++++-------- ...importAssertion1(module=esnext).errors.txt | 20 ++++++++-------- ...portAssertion2(module=commonjs).errors.txt | 24 +++++++++---------- ...importAssertion2(module=es2015).errors.txt | 24 +++++++++---------- ...importAssertion2(module=esnext).errors.txt | 24 +++++++++---------- ...importAssertion3(module=es2015).errors.txt | 16 ++++++------- ...importAssertion3(module=esnext).errors.txt | 16 ++++++------- .../importAssertionNonstring.errors.txt | 24 +++++++++---------- ...ImportAssertions(module=node16).errors.txt | 8 +++---- ...portAssertions(module=nodenext).errors.txt | 8 +++---- ...DeclarationEmit1(module=node16).errors.txt | 24 +++++++++---------- ...clarationEmit1(module=nodenext).errors.txt | 24 +++++++++---------- ...DeclarationEmit2(module=node16).errors.txt | 24 +++++++++---------- ...clarationEmit2(module=nodenext).errors.txt | 24 +++++++++---------- ...ationEmitErrors1(module=node16).errors.txt | 12 +++++----- ...ionEmitErrors1(module=nodenext).errors.txt | 12 +++++----- 19 files changed, 164 insertions(+), 164 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index edf64d71cc275..141c7489e7956 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -45058,7 +45058,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function checkImportAttributes(declaration: ImportDeclaration | ExportDeclaration) { if (declaration.assertClause) { - grammarErrorOnFirstToken(declaration.assertClause, Diagnostics.The_assert_keyword_in_import_attributes_is_deprecated_and_it_has_been_replaced_by_the_with_keyword); + grammarErrorOnFirstToken(declaration.assertClause, Diagnostics.The_assert_keyword_in_import_attributes_is_deprecated_and_has_been_replaced_by_the_with_keyword); } const node = declaration.attributes || declaration.assertClause; if (node) { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index b3143d30451f2..e4e1a29fa8414 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -19,7 +19,7 @@ "category": "Error", "code": 1007 }, - "The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword.": { + "The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword.": { "category": "Error", "code": 1008 }, diff --git a/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt b/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt index 8e88dbb705ee6..6c6386c9bf0b9 100644 --- a/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt @@ -1,12 +1,12 @@ -1.ts(1,14): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(1,14): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(3,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(3,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. 3.ts(2,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. 3.ts(3,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. @@ -26,17 +26,17 @@ ==== 1.ts (6 errors) ==== import './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import { a, b } from './0' assert { "type": "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import * as foo from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. a; @@ -47,12 +47,12 @@ ==== 2.ts (4 errors) ==== import { a, b } from './0' assert {} ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. a; diff --git a/tests/baselines/reference/importAssertion1(module=es2015).errors.txt b/tests/baselines/reference/importAssertion1(module=es2015).errors.txt index 04af372ea2e50..a60d56281e1c3 100644 --- a/tests/baselines/reference/importAssertion1(module=es2015).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=es2015).errors.txt @@ -1,12 +1,12 @@ -1.ts(1,14): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(1,14): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(3,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(3,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. 3.ts(1,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. 3.ts(2,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. @@ -26,17 +26,17 @@ ==== 1.ts (6 errors) ==== import './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import { a, b } from './0' assert { "type": "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import * as foo from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. a; @@ -47,12 +47,12 @@ ==== 2.ts (4 errors) ==== import { a, b } from './0' assert {} ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. a; diff --git a/tests/baselines/reference/importAssertion1(module=esnext).errors.txt b/tests/baselines/reference/importAssertion1(module=esnext).errors.txt index a861bded301a5..ef3a0577ab588 100644 --- a/tests/baselines/reference/importAssertion1(module=esnext).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=esnext).errors.txt @@ -1,8 +1,8 @@ -1.ts(1,14): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -1.ts(3,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(1,14): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +1.ts(3,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 3.ts(8,11): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments 3.ts(9,11): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments @@ -14,13 +14,13 @@ ==== 1.ts (3 errors) ==== import './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. import { a, b } from './0' assert { "type": "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. import * as foo from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. a; b; foo.a; @@ -29,10 +29,10 @@ ==== 2.ts (2 errors) ==== import { a, b } from './0' assert {} ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. a; b; c; diff --git a/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt b/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt index 193ad948653cb..5a6418d13216a 100644 --- a/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt +++ b/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt @@ -1,14 +1,14 @@ -1.ts(1,22): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(1,22): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(1,22): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(3,21): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(3,21): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(4,27): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(4,27): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. @@ -19,34 +19,34 @@ ==== 1.ts (8 errors) ==== export {} from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export { a, b } from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export * from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export * as ns from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ==== 2.ts (4 errors) ==== export { a, b } from './0' assert {} ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion2(module=es2015).errors.txt b/tests/baselines/reference/importAssertion2(module=es2015).errors.txt index 193ad948653cb..5a6418d13216a 100644 --- a/tests/baselines/reference/importAssertion2(module=es2015).errors.txt +++ b/tests/baselines/reference/importAssertion2(module=es2015).errors.txt @@ -1,14 +1,14 @@ -1.ts(1,22): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(1,22): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(1,22): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(3,21): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(3,21): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(4,27): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(4,27): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. @@ -19,34 +19,34 @@ ==== 1.ts (8 errors) ==== export {} from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export { a, b } from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export * from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export * as ns from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ==== 2.ts (4 errors) ==== export { a, b } from './0' assert {} ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion2(module=esnext).errors.txt b/tests/baselines/reference/importAssertion2(module=esnext).errors.txt index e05f06666e93a..8bc2a04097e3d 100644 --- a/tests/baselines/reference/importAssertion2(module=esnext).errors.txt +++ b/tests/baselines/reference/importAssertion2(module=esnext).errors.txt @@ -1,9 +1,9 @@ -1.ts(1,22): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -1.ts(3,21): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -1.ts(4,27): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(1,22): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +1.ts(3,21): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +1.ts(4,27): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ==== 0.ts (0 errors) ==== @@ -13,22 +13,22 @@ ==== 1.ts (4 errors) ==== export {} from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export { a, b } from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export * from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export * as ns from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ==== 2.ts (2 errors) ==== export { a, b } from './0' assert {} ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion3(module=es2015).errors.txt b/tests/baselines/reference/importAssertion3(module=es2015).errors.txt index 861c09db5d4b1..639877e41d115 100644 --- a/tests/baselines/reference/importAssertion3(module=es2015).errors.txt +++ b/tests/baselines/reference/importAssertion3(module=es2015).errors.txt @@ -1,10 +1,10 @@ -1.ts(1,27): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(1,27): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(1,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(2,30): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(2,30): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(2,30): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,31): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +2.ts(1,31): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(1,31): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,33): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +2.ts(2,33): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(2,33): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. @@ -14,24 +14,24 @@ ==== 1.ts (4 errors) ==== export type {} from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export type { I } from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ==== 2.ts (4 errors) ==== import type { I } from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import type * as foo from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. diff --git a/tests/baselines/reference/importAssertion3(module=esnext).errors.txt b/tests/baselines/reference/importAssertion3(module=esnext).errors.txt index 98f87a6248ab1..47b48e70673c7 100644 --- a/tests/baselines/reference/importAssertion3(module=esnext).errors.txt +++ b/tests/baselines/reference/importAssertion3(module=esnext).errors.txt @@ -1,10 +1,10 @@ -1.ts(1,27): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(1,27): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(1,27): error TS2822: Import assertions cannot be used with type-only imports or exports. -1.ts(2,30): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +1.ts(2,30): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(2,30): error TS2822: Import assertions cannot be used with type-only imports or exports. -2.ts(1,31): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +2.ts(1,31): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(1,31): error TS2822: Import assertions cannot be used with type-only imports or exports. -2.ts(2,33): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +2.ts(2,33): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(2,33): error TS2822: Import assertions cannot be used with type-only imports or exports. @@ -14,24 +14,24 @@ ==== 1.ts (4 errors) ==== export type {} from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2822: Import assertions cannot be used with type-only imports or exports. export type { I } from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2822: Import assertions cannot be used with type-only imports or exports. ==== 2.ts (4 errors) ==== import type { I } from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2822: Import assertions cannot be used with type-only imports or exports. import type * as foo from './0' assert { type: "json" } ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2822: Import assertions cannot be used with type-only imports or exports. diff --git a/tests/baselines/reference/importAssertionNonstring.errors.txt b/tests/baselines/reference/importAssertionNonstring.errors.txt index 378669e4be284..0ddc2d24061c9 100644 --- a/tests/baselines/reference/importAssertionNonstring.errors.txt +++ b/tests/baselines/reference/importAssertionNonstring.errors.txt @@ -1,50 +1,50 @@ -mod.mts(1,37): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +mod.mts(1,37): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. mod.mts(1,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(3,37): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +mod.mts(3,37): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. mod.mts(3,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(5,37): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +mod.mts(5,37): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. mod.mts(5,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(7,37): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +mod.mts(7,37): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. mod.mts(7,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(9,37): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +mod.mts(9,37): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. mod.mts(9,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(11,37): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +mod.mts(11,37): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. mod.mts(11,66): error TS2837: Import assertion values must be string literal expressions. ==== mod.mts (12 errors) ==== import * as thing1 from "./mod.mjs" assert {field: 0}; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing2 from "./mod.mjs" assert {field: `a`}; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing3 from "./mod.mjs" assert {field: /a/g}; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing4 from "./mod.mjs" assert {field: ["a"]}; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing5 from "./mod.mjs" assert {field: { a: 0 }}; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing6 from "./mod.mjs" assert {type: "json", field: 0..toString()} ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~ !!! error TS2837: Import assertion values must be string literal expressions. \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt index 9358d3e99bf21..d8cb3cc4a4bc7 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt @@ -1,7 +1,7 @@ error TS2468: Cannot find global value 'Promise'. -index.ts(1,35): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +index.ts(1,35): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. index.ts(1,35): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -otherc.cts(1,35): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +otherc.cts(1,35): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. otherc.cts(1,35): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. otherc.cts(2,15): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. @@ -10,13 +10,13 @@ otherc.cts(2,15): error TS2712: A dynamic import call in ES5/ES3 requires the 'P ==== index.ts (2 errors) ==== import json from "./package.json" assert { type: "json" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ==== otherc.cts (3 errors) ==== import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).errors.txt index ed6626bfc4ea0..0e95c13d77262 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).errors.txt @@ -1,6 +1,6 @@ error TS2468: Cannot find global value 'Promise'. -index.ts(1,35): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -otherc.cts(1,35): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +index.ts(1,35): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +otherc.cts(1,35): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. otherc.cts(1,35): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. otherc.cts(2,15): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. @@ -9,11 +9,11 @@ otherc.cts(2,15): error TS2712: A dynamic import call in ES5/ES3 requires the 'P ==== index.ts (1 errors) ==== import json from "./package.json" assert { type: "json" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ==== otherc.cts (3 errors) ==== import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt index 17bdeae24d156..95e54e348830c 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt @@ -1,44 +1,44 @@ -/index.ts(1,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -/index.ts(2,44): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -/index.ts(6,50): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(1,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +/index.ts(2,44): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +/index.ts(6,50): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(7,49): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -/index.ts(10,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -/index.ts(11,44): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(10,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +/index.ts(11,44): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ==== /index.ts (9 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt index 67c44cad05803..cba0aa59ef9e7 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt @@ -1,44 +1,44 @@ -/index.ts(1,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -/index.ts(2,44): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -/index.ts(6,50): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(1,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +/index.ts(2,44): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +/index.ts(6,50): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(6,50): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(7,49): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(7,49): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. -/index.ts(10,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -/index.ts(11,44): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(10,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +/index.ts(11,44): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ==== /index.ts (9 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt index ddae949b7eee9..bb79ece0f8c8d 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt @@ -1,21 +1,21 @@ -/index.ts(1,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -/index.ts(2,44): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(1,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +/index.ts(2,44): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -/index.ts(6,50): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(6,50): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -/index.ts(7,49): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(7,49): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -/index.ts(10,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -/index.ts(11,44): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(10,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +/index.ts(11,44): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ==== /index.ts (9 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -23,22 +23,22 @@ ~~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt index e9eaec3599d71..bc5dbb52a172d 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt @@ -1,21 +1,21 @@ -/index.ts(1,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -/index.ts(2,44): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(1,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +/index.ts(2,44): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -/index.ts(6,50): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(6,50): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(7,49): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(7,49): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(10,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. -/index.ts(11,44): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(10,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. +/index.ts(11,44): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ==== /index.ts (9 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -23,22 +23,22 @@ ~~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1454: `resolution-mode` can only be set for type-only imports. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1454: `resolution-mode` can only be set for type-only imports. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt index 62fd5941c7d42..8f2854edf434e 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt @@ -1,10 +1,10 @@ -/index.ts(2,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(2,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(2,45): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(4,39): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(4,39): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(4,39): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -/index.ts(6,76): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(6,76): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(6,76): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. @@ -12,7 +12,7 @@ // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ~~~~~~~~ @@ -22,13 +22,13 @@ ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt index 3fded26eb8f2b..5857b0648bf3c 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt @@ -1,10 +1,10 @@ -/index.ts(2,45): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(2,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(2,45): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(4,39): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(4,39): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(4,39): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. -/index.ts(6,76): error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +/index.ts(6,76): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(6,76): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. @@ -12,7 +12,7 @@ // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. ~~~~~~~~ @@ -22,13 +22,13 @@ ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and it has been replaced by the 'with' keyword. +!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. From a38770046c882cf32f96be0a4163200e7d3559f4 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Thu, 14 Sep 2023 21:22:46 +0300 Subject: [PATCH 10/21] remove the nightly-only restriction of resolution mode override --- src/compiler/checker.ts | 44 ++++----------------- src/compiler/diagnosticMessages.json | 8 ---- src/compiler/transformers/declarations.ts | 48 +++++++---------------- src/compiler/types.ts | 1 - src/compiler/utilities.ts | 6 --- 5 files changed, 21 insertions(+), 86 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 141c7489e7956..5c6ab88ea9827 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -643,7 +643,6 @@ import { isNamespaceExportDeclaration, isNamespaceReexportDeclaration, isNewExpression, - isNightly, isNodeDescendantOf, isNonNullAccess, isNullishCoalesce, @@ -7905,7 +7904,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { factory.createStringLiteral("import"), ), ]))); - context.tracker.reportImportTypeNodeResolutionModeOverride?.(); } } if (!specifier) { @@ -7929,7 +7927,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { factory.createStringLiteral(swappedMode === ModuleKind.ESNext ? "import" : "require"), ), ]))); - context.tracker.reportImportTypeNodeResolutionModeOverride?.(); } } @@ -39600,26 +39597,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (node.assertions || node.attributes) { const override = getResolutionModeOverride(node.assertions?.assertClause || node.attributes?.attributes, grammarErrorOnNode); const errorNode = node.assertions?.assertClause || node.attributes?.attributes; - if (override && errorNode) { - if (!isNightly()) { - grammarErrorOnNode( - errorNode, - node.assertions?.assertClause - ? Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next - : Diagnostics.resolution_mode_attributes_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, - ); - } - if (getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Node16 && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.NodeNext) { - grammarErrorOnNode( - errorNode, - node.assertions?.assertClause - ? Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext - : Diagnostics.resolution_mode_attribute_are_only_supported_when_moduleResolution_is_node16_or_nodenext, - ); - } + if (override && errorNode && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Node16 && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.NodeNext) { + grammarErrorOnNode( + errorNode, + node.assertions?.assertClause + ? Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext + : Diagnostics.resolution_mode_attribute_are_only_supported_when_moduleResolution_is_node16_or_nodenext, + ); } } - checkTypeReferenceOrImport(node); } @@ -45065,15 +45051,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const validForTypeAttributes = isExclusivelyTypeOnlyImportOrExport(declaration); const override = getResolutionModeOverride(node, validForTypeAttributes ? grammarErrorOnNode : undefined); if (validForTypeAttributes && override) { - if (!isNightly()) { - grammarErrorOnNode( - node, - declaration.attributes - ? Diagnostics.resolution_mode_attributes_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next - : Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, - ); - } - if (getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Node16 && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.NodeNext) { return grammarErrorOnNode( node, @@ -50109,13 +50086,6 @@ class SymbolTrackerImpl implements SymbolTracker { } } - reportImportTypeNodeResolutionModeOverride(): void { - if (this.inner?.reportImportTypeNodeResolutionModeOverride) { - this.onDiagnosticReported(); - this.inner.reportImportTypeNodeResolutionModeOverride(); - } - } - private onDiagnosticReported() { this.context.reportedDiagnostic = true; } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index e4e1a29fa8414..3dbba6d019c6c 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4132,14 +4132,6 @@ "category": "Error", "code": 4124 }, - "'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.": { - "category": "Error", - "code": 4125 - }, - "'resolution-mode' attributes are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.": { - "category": "Error", - "code": 4126 - }, "The current host does not support the '{0}' option.": { "category": "Error", diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 465e500b60fd9..64e1788837937 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -119,7 +119,6 @@ import { isIdentifier, isIdentifierANonContextualKeyword, isIdentifierText, - isImportAttributes, isImportDeclaration, isImportEqualsDeclaration, isIndexSignatureDeclaration, @@ -132,7 +131,6 @@ import { isMethodSignature, isModifier, isModuleDeclaration, - isNightly, isOmittedExpression, isPrivateIdentifier, isPropertyAccessExpression, @@ -316,7 +314,6 @@ export function transformDeclarations(context: TransformationContext) { trackExternalModuleSymbolOfImportTypeNode, reportNonlocalAugmentation, reportNonSerializableProperty, - reportImportTypeNodeResolutionModeOverride, }; let errorNameNode: DeclarationName | undefined; let errorFallbackNode: Declaration | undefined; @@ -460,12 +457,6 @@ export function transformDeclarations(context: TransformationContext) { } } - function reportImportTypeNodeResolutionModeOverride() { - if (!isNightly() && (errorNameNode || errorFallbackNode)) { - context.addDiagnostic(createDiagnosticForNode((errorNameNode || errorFallbackNode)!, Diagnostics.The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_feature_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next)); - } - } - function transformDeclarationsForJS(sourceFile: SourceFile, bundled?: boolean) { const oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = s => (s.errorNode && canProduceDiagnostics(s.errorNode) ? createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : ({ @@ -986,8 +977,8 @@ export function transformDeclarations(context: TransformationContext) { decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier), - getResolutionModeOverrideInNightly(decl.assertClause), - getResolutionModeOverrideInNightly(decl.attributes), + tryGetResolutionModeOverride(decl.assertClause), + tryGetResolutionModeOverride(decl.attributes), ); } // The `importClause` visibility corresponds to the default's visibility. @@ -1004,8 +995,8 @@ export function transformDeclarations(context: TransformationContext) { /*namedBindings*/ undefined, ), rewriteModuleSpecifier(decl, decl.moduleSpecifier), - getResolutionModeOverrideInNightly(decl.assertClause), - getResolutionModeOverrideInNightly(decl.attributes), + tryGetResolutionModeOverride(decl.assertClause), + tryGetResolutionModeOverride(decl.attributes), ); } if (decl.importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { @@ -1021,8 +1012,8 @@ export function transformDeclarations(context: TransformationContext) { namedBindings, ), rewriteModuleSpecifier(decl, decl.moduleSpecifier), - getResolutionModeOverrideInNightly(decl.assertClause), - getResolutionModeOverrideInNightly(decl.attributes), + tryGetResolutionModeOverride(decl.assertClause), + tryGetResolutionModeOverride(decl.attributes), ) : undefined; } // Named imports (optionally with visible default) @@ -1038,8 +1029,8 @@ export function transformDeclarations(context: TransformationContext) { bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined, ), rewriteModuleSpecifier(decl, decl.moduleSpecifier), - getResolutionModeOverrideInNightly(decl.assertClause), - getResolutionModeOverrideInNightly(decl.attributes), + tryGetResolutionModeOverride(decl.assertClause), + tryGetResolutionModeOverride(decl.attributes), ); } // Augmentation of export depends on import @@ -1049,27 +1040,16 @@ export function transformDeclarations(context: TransformationContext) { decl.modifiers, /*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier), - getResolutionModeOverrideInNightly(decl.assertClause), - getResolutionModeOverrideInNightly(decl.attributes), + tryGetResolutionModeOverride(decl.assertClause), + tryGetResolutionModeOverride(decl.attributes), ); } // Nothing visible } - function getResolutionModeOverrideInNightly(node: T | undefined) { + function tryGetResolutionModeOverride(node: T | undefined) { const mode = getResolutionModeOverride(node); - if (node && mode !== undefined) { - if (!isNightly()) { - context.addDiagnostic(createDiagnosticForNode( - node, - isImportAttributes(node) - ? Diagnostics.resolution_mode_attributes_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next - : Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, - )); - } - return node; - } - return undefined; + return node && mode !== undefined ? node : undefined; } function transformAndReplaceLatePaintedStatements(statements: NodeArray): NodeArray { @@ -1403,8 +1383,8 @@ export function transformDeclarations(context: TransformationContext) { input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), - getResolutionModeOverrideInNightly(input.assertClause) ? input.assertClause : undefined, - getResolutionModeOverrideInNightly(input.attributes) ? input.attributes : undefined, + tryGetResolutionModeOverride(input.assertClause), + tryGetResolutionModeOverride(input.attributes), ); } case SyntaxKind.ExportAssignment: { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 33ddec5267e99..08ecc2c229cdb 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -9673,7 +9673,6 @@ export interface SymbolTracker { trackExternalModuleSymbolOfImportTypeNode?(symbol: Symbol): void; reportNonlocalAugmentation?(containingFile: SourceFile, parentSymbol: Symbol, augmentingSymbol: Symbol): void; reportNonSerializableProperty?(propertyName: string): void; - reportImportTypeNodeResolutionModeOverride?(): void; } export interface TextSpan { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 505666468e299..42d270524a1dd 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -556,7 +556,6 @@ import { VariableDeclarationList, VariableLikeDeclaration, VariableStatement, - version, WhileStatement, WithStatement, WrappedExpression, @@ -6006,11 +6005,6 @@ export function getIndentSize() { return indentStrings[1].length; } -/** @internal */ -export function isNightly() { - return stringContains(version, "-dev") || stringContains(version, "-insiders"); -} - /** @internal */ export function createTextWriter(newLine: string): EmitTextWriter { // Why var? It avoids TDZ checks in the runtime which can be costly. From 0113dfec59e37e98e507bbd222077aaae3708108 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Thu, 14 Sep 2023 21:39:04 +0300 Subject: [PATCH 11/21] remove unused diagnostic message --- src/compiler/diagnosticMessages.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 7eb9e474ffa40..d5daa8a88a17a 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3635,10 +3635,6 @@ "category": "Error", "code": 2840 }, - "The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.": { - "category": "Error", - "code": 2841 - }, "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?": { "category": "Error", "code": 2842 From 14c6226503f018bdabdf552f22ae42dc8b32c932 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Thu, 21 Sep 2023 22:03:56 +0300 Subject: [PATCH 12/21] AssertClause -> ImportAttributes --- src/compiler/checker.ts | 70 +++---- src/compiler/emitter.ts | 52 +---- src/compiler/factory/nodeFactory.ts | 53 +++-- src/compiler/factory/utilities.ts | 1 - src/compiler/parser.ts | 164 ++++------------ src/compiler/program.ts | 6 +- src/compiler/transformers/declarations.ts | 10 +- src/compiler/transformers/jsx.ts | 2 +- .../transformers/module/esnextAnd2015.ts | 2 - src/compiler/transformers/ts.ts | 3 - src/compiler/types.ts | 52 ++--- src/compiler/utilities.ts | 4 +- src/compiler/utilitiesPublic.ts | 8 +- src/compiler/visitorPublic.ts | 31 --- .../codefixes/convertToTypeOnlyExport.ts | 2 - .../codefixes/convertToTypeOnlyImport.ts | 4 +- .../fixAddModuleReferTypeMissingTypeof.ts | 2 +- .../codefixes/fixImportNonExportedMember.ts | 3 +- src/services/codefixes/importFixes.ts | 1 - src/services/codefixes/requireInTs.ts | 2 +- src/services/codefixes/splitTypeOnlyImport.ts | 2 - src/services/organizeImports.ts | 3 - src/services/refactors/convertExport.ts | 2 +- src/services/refactors/convertImport.ts | 2 +- src/services/refactors/moveToFile.ts | 5 +- src/services/utilities.ts | 1 - src/testRunner/unittests/transform.ts | 3 +- tests/baselines/reference/api/typescript.d.ts | 184 ++++++++---------- .../baselines/reference/importAttributes7.js | 6 +- .../reference/importAttributes7.symbols | 7 +- .../reference/importAttributes7.types | 14 +- .../baselines/reference/importAttributes8.js | 5 +- .../reference/importAttributes8.symbols | 7 +- .../reference/importAttributes8.types | 12 +- .../parseUnmatchedTypeAssertion.errors.txt | 5 +- .../importAttributes/importAttributes7.ts | 4 +- .../importAttributes/importAttributes8.ts | 4 +- 37 files changed, 242 insertions(+), 496 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5a7dcd8713f60..3856b3cd99409 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -25,7 +25,6 @@ import { ArrayTypeNode, ArrowFunction, AsExpression, - AssertClause, AssertionExpression, AssignmentDeclarationKind, AssignmentKind, @@ -406,7 +405,6 @@ import { IdentifierTypePredicate, idText, IfStatement, - ImportAttributes, ImportCall, ImportClause, ImportDeclaration, @@ -7127,7 +7125,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return factory.updateImportTypeNode( root, root.argument, - root.assertions, root.attributes, qualifier, typeArguments, @@ -7921,7 +7918,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // An `import` type directed at an esm format file is only going to resolve in esm mode - set the esm mode assertion if (targetFile?.impliedNodeFormat === ModuleKind.ESNext && targetFile.impliedNodeFormat !== contextFile?.impliedNodeFormat) { specifier = getSpecifierForModuleSymbol(chain[0], context, ModuleKind.ESNext); - attributes = factory.createImportTypeAttributes(factory.createImportAttributes(factory.createNodeArray([ + attributes = factory.createImportTypeAttributes(factory.createImportAttributes(SyntaxKind.WithKeyword, factory.createNodeArray([ factory.createImportAttribute( factory.createStringLiteral("resolution-mode"), factory.createStringLiteral("import"), @@ -7944,7 +7941,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { specifier = oldSpecifier; } else { - attributes = factory.createImportTypeAttributes(factory.createImportAttributes(factory.createNodeArray([ + attributes = factory.createImportTypeAttributes(factory.createImportAttributes(SyntaxKind.WithKeyword, factory.createNodeArray([ factory.createImportAttribute( factory.createStringLiteral("resolution-mode"), factory.createStringLiteral(swappedMode === ModuleKind.ESNext ? "import" : "require"), @@ -7970,12 +7967,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const lastId = isIdentifier(nonRootParts) ? nonRootParts : nonRootParts.right; setIdentifierTypeArguments(lastId, /*typeArguments*/ undefined); } - return factory.createImportTypeNode(lit, /*assertions*/ undefined, attributes, nonRootParts as EntityName, typeParameterNodes as readonly TypeNode[], isTypeOf); + return factory.createImportTypeNode(lit, attributes, nonRootParts as EntityName, typeParameterNodes as readonly TypeNode[], isTypeOf); } else { const splitNode = getTopmostIndexedAccessType(nonRootParts); const qualifier = (splitNode.objectType as TypeReferenceNode).typeName; - return factory.createIndexedAccessTypeNode(factory.createImportTypeNode(lit, /*assertions*/ undefined, attributes, qualifier, typeParameterNodes as readonly TypeNode[], isTypeOf), splitNode.indexType); + return factory.createIndexedAccessTypeNode(factory.createImportTypeNode(lit, attributes, qualifier, typeParameterNodes as readonly TypeNode[], isTypeOf), splitNode.indexType); } } @@ -8482,7 +8479,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return factory.updateImportTypeNode( node, factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier(node, node.argument.literal)), - node.assertions, node.attributes, node.qualifier, visitNodes(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode), @@ -8708,7 +8704,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { 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.assertClause || d.attributes) && !!d.exportClause && isNamedExports(d.exportClause)); + const index = findIndex(statements, d => isExportDeclaration(d) && !d.moduleSpecifier && !d.attributes && !!d.exportClause && isNamedExports(d.exportClause)); if (index >= 0) { const exportDecl = statements[index] as ExportDeclaration & { readonly exportClause: NamedExports; }; const replacements = mapDefined(exportDecl.exportClause.elements, e => { @@ -8740,7 +8736,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { replacements, ), exportDecl.moduleSpecifier, - exportDecl.assertClause, exportDecl.attributes, ); } @@ -9463,7 +9458,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { )]), ), factory.createStringLiteral(specifier), - /*assertClause*/ undefined, /*attributes*/ undefined, ), ModifierFlags.None, @@ -9548,7 +9542,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { /*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, factory.createIdentifier(localName), /*namedBindings*/ undefined), specifier, - (node as ImportClause).parent.assertClause, (node as ImportClause).parent.attributes, ), ModifierFlags.None, @@ -9563,7 +9556,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { /*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, factory.createNamespaceImport(factory.createIdentifier(localName))), specifier, - (node as NamespaceImport).parent.parent.assertClause, (node as ImportClause).parent.attributes, ), ModifierFlags.None, @@ -9599,7 +9591,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { ]), ), specifier, - (node as ImportSpecifier).parent.parent.parent.assertClause, (node as ImportSpecifier).parent.parent.parent.attributes, ), ModifierFlags.None, @@ -39698,15 +39689,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function checkImportType(node: ImportTypeNode) { checkSourceElement(node.argument); - if (node.assertions || node.attributes) { - const override = getResolutionModeOverride(node.assertions?.assertClause || node.attributes?.attributes, grammarErrorOnNode); - const errorNode = node.assertions?.assertClause || node.attributes?.attributes; + if (node.attributes) { + const override = getResolutionModeOverride(node.attributes?.attributes, grammarErrorOnNode); + const errorNode = node.attributes?.attributes; if (override && errorNode && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Node16 && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.NodeNext) { grammarErrorOnNode( errorNode, - node.assertions?.assertClause - ? Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext - : Diagnostics.resolution_mode_attribute_are_only_supported_when_moduleResolution_is_node16_or_nodenext, + node.attributes.attributes.token === SyntaxKind.WithKeyword + ? Diagnostics.resolution_mode_attribute_are_only_supported_when_moduleResolution_is_node16_or_nodenext + : Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext ); } } @@ -44948,28 +44939,20 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return false; } } - if (!isImportEqualsDeclaration(node)) { - if (node.attributes) { - return checkImportAttributeValue(node.attributes, Diagnostics.Import_attribute_values_must_be_string_literal_expressions); - } - if (node.assertClause) { - return checkImportAttributeValue(node.assertClause, Diagnostics.Import_assertion_values_must_be_string_literal_expressions); + if (!isImportEqualsDeclaration(node) && node.attributes) { + const diagnostic = node.attributes.token === SyntaxKind.WithKeyword ? Diagnostics.Import_attribute_values_must_be_string_literal_expressions : Diagnostics.Import_assertion_values_must_be_string_literal_expressions; + let hasError = false; + for (const attr of node.attributes.elements) { + if (!isStringLiteral(attr.value)) { + hasError = true; + error(attr.value, diagnostic); + } } + return !hasError; } return true; } - function checkImportAttributeValue(node: AssertClause | ImportAttributes, message: DiagnosticMessage) { - let hasError = false; - for (const clause of node.elements) { - if (!isStringLiteral(clause.value)) { - hasError = true; - error(clause.value, message); - } - } - return !hasError; - } - function checkAliasSymbol(node: AliasDeclarationNode) { let symbol = getSymbolOfDeclaration(node); const target = resolveAlias(symbol); @@ -45147,18 +45130,19 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function checkImportAttributes(declaration: ImportDeclaration | ExportDeclaration) { - if (declaration.assertClause) { - grammarErrorOnFirstToken(declaration.assertClause, Diagnostics.The_assert_keyword_in_import_attributes_is_deprecated_and_has_been_replaced_by_the_with_keyword); + if (declaration.attributes && declaration.attributes.token === SyntaxKind.AssertKeyword) { + grammarErrorOnFirstToken(declaration.attributes, Diagnostics.The_assert_keyword_in_import_attributes_is_deprecated_and_has_been_replaced_by_the_with_keyword); } - const node = declaration.attributes || declaration.assertClause; + const node = declaration.attributes; if (node) { const validForTypeAttributes = isExclusivelyTypeOnlyImportOrExport(declaration); const override = getResolutionModeOverride(node, validForTypeAttributes ? grammarErrorOnNode : undefined); + const isImportAttributes = declaration.attributes.token === SyntaxKind.WithKeyword; if (validForTypeAttributes && override) { if (getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Node16 && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.NodeNext) { return grammarErrorOnNode( node, - declaration.attributes + isImportAttributes ? Diagnostics.resolution_mode_attribute_are_only_supported_when_moduleResolution_is_node16_or_nodenext : Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext, ); @@ -45168,7 +45152,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const mode = (moduleKind === ModuleKind.NodeNext) && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier); if (mode !== ModuleKind.ESNext && moduleKind !== ModuleKind.ESNext) { - const message = declaration.attributes + const message = isImportAttributes ? moduleKind === ModuleKind.NodeNext ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_transpile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext @@ -45179,7 +45163,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } if (isImportDeclaration(declaration) ? declaration.importClause?.isTypeOnly : declaration.isTypeOnly) { - return grammarErrorOnNode(node, declaration.attributes ? Diagnostics.Import_attributes_cannot_be_used_with_type_only_imports_or_exports : Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports); + return grammarErrorOnNode(node, isImportAttributes ? Diagnostics.Import_attributes_cannot_be_used_with_type_only_imports_or_exports : Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports); } if (override) { diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index d16fa896b82e6..9e9387a58515f 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -7,8 +7,6 @@ import { ArrayTypeNode, ArrowFunction, AsExpression, - AssertClause, - AssertEntry, AwaitExpression, base64encode, BigIntLiteral, @@ -2055,10 +2053,6 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri 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.ImportAttributes: return emitImportAttributes(node as ImportAttributes); case SyntaxKind.ImportAttribute: @@ -2952,25 +2946,12 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri writeKeyword("import"); writePunctuation("("); emit(node.argument); - if (node.assertions) { - writePunctuation(","); - writeSpace(); - writePunctuation("{"); - writeSpace(); - writeKeyword("assert"); - writePunctuation(":"); - writeSpace(); - const elements = node.assertions.assertClause.elements; - emitList(node.assertions.assertClause, elements, ListFormat.ImportClauseEntries); - writeSpace(); - writePunctuation("}"); - } if (node.attributes) { writePunctuation(","); writeSpace(); writePunctuation("{"); writeSpace(); - writeKeyword("with"); + emitTokenWithComment(node.attributes.attributes.token, node.pos, writeKeyword, node); writePunctuation(":"); writeSpace(); const elements = node.attributes.attributes.elements; @@ -4009,8 +3990,8 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri writeSpace(); } emitExpression(node.moduleSpecifier); - if (node.attributes || node.assertClause) { - emitWithLeadingSpace(node.attributes || node.assertClause); + if (node.attributes) { + emitWithLeadingSpace(node.attributes); } writeTrailingSemicolon(); } @@ -4084,35 +4065,14 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri writeSpace(); emitExpression(node.moduleSpecifier); } - if (node.attributes || node.assertClause) { - emitWithLeadingSpace(node.attributes || node.assertClause); + if (node.attributes) { + emitWithLeadingSpace(node.attributes); } 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 emitImportAttributes(node: ImportAttributes) { - emitTokenWithComment(SyntaxKind.WithKeyword, node.pos, writeKeyword, node); + emitTokenWithComment(node.token, node.pos, writeKeyword, node); writeSpace(); const elements = node.elements; emitList(node, elements, ListFormat.ImportAttributes); diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 43f4c1fd22a49..0933e9f557fe7 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -2651,18 +2651,18 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode } // @api + function createImportTypeNode(argument: TypeNode, assertions?: ImportTypeAssertionContainer, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; + function createImportTypeNode(argument: TypeNode, attributes?: ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; function createImportTypeNode( argument: TypeNode, - assertions?: ImportTypeAssertionContainer, - attributes?: ImportTypeAttributes, + attributes?: ImportTypeAssertionContainer | ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf = false, ): ImportTypeNode { const node = createBaseNode(SyntaxKind.ImportType); node.argument = argument; - node.assertions = assertions; - node.attributes = attributes; + node.attributes = node.assertions = attributes; node.qualifier = qualifier; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.isTypeOf = isTypeOf; @@ -2671,22 +2671,23 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode } // @api + function updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, assertions: ImportTypeAssertionContainer | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean | undefined): ImportTypeNode; + function updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, attributes: ImportTypeAttributes | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean | undefined): ImportTypeNode; function updateImportTypeNode( node: ImportTypeNode, argument: TypeNode, - assertions: ImportTypeAssertionContainer | undefined, - attributes: ImportTypeAttributes | undefined, + attributes: ImportTypeAssertionContainer | ImportTypeAttributes | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf: boolean = node.isTypeOf, ): ImportTypeNode { return node.argument !== argument - || node.assertions !== assertions + || node.assertions !== attributes || node.attributes !== attributes || node.qualifier !== qualifier || node.typeArguments !== typeArguments || node.isTypeOf !== isTypeOf - ? update(createImportTypeNode(argument, assertions, attributes, qualifier, typeArguments, isTypeOf), node) + ? update(createImportTypeNode(argument, attributes, qualifier, typeArguments, isTypeOf), node) : node; } @@ -4710,15 +4711,13 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, - assertClause: AssertClause | undefined, - attributes: ImportAttributes | undefined, + attributes: ImportAttributes | AssertClause | undefined, ): ImportDeclaration { const node = createBaseNode(SyntaxKind.ImportDeclaration); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; - node.assertClause = assertClause; - node.attributes = attributes; + node.attributes = node.assertClause = attributes; node.transformFlags |= propagateChildFlags(node.importClause) | propagateChildFlags(node.moduleSpecifier); node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // always parsed in an Await context @@ -4733,15 +4732,13 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, - assertClause: AssertClause | undefined, - attributes: ImportAttributes | undefined, + attributes: ImportAttributes | AssertClause | undefined, ) { return node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier - || node.assertClause !== assertClause || node.attributes !== attributes - ? update(createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause, attributes), node) + ? update(createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes), node) : node; } @@ -4774,6 +4771,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode const node = createBaseNode(SyntaxKind.AssertClause); node.elements = createNodeArray(elements); node.multiLine = multiLine; + node.token = SyntaxKind.AssertKeyword; node.transformFlags |= TransformFlags.ContainsESNext; return node; } @@ -4822,7 +4820,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function createImportTypeAttributes(attributes: ImportAttributes, multiLine?: boolean): ImportTypeAttributes { const node = createBaseNode(SyntaxKind.ImportTypeAttributes); - node.attributes = attributes; + node.attributes = node.assertClause = attributes; node.multiLine = multiLine; return node; } @@ -4836,8 +4834,9 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode } // @api - function createImportAttributes(elements: readonly ImportAttribute[], multiLine?: boolean): ImportAttributes { + function createImportAttributes(token: ImportAttributes["token"], elements: readonly ImportAttribute[], multiLine?: boolean): ImportAttributes { const node = createBaseNode(SyntaxKind.ImportAttributes); + node.token = token; node.elements = createNodeArray(elements); node.multiLine = multiLine; node.transformFlags |= TransformFlags.ContainsESNext; @@ -4848,7 +4847,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function updateImportAttributes(node: ImportAttributes, elements: readonly ImportAttribute[], multiLine?: boolean): ImportAttributes { return node.elements !== elements || node.multiLine !== multiLine - ? update(createImportAttributes(elements, multiLine), node) + ? update(createImportAttributes(node.token, elements, multiLine), node) : node; } @@ -4976,16 +4975,14 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, - assertClause?: AssertClause, - attributes?: ImportAttributes, + attributes?: AssertClause | ImportAttributes, ) { const node = createBaseDeclaration(SyntaxKind.ExportDeclaration); node.modifiers = asNodeArray(modifiers); node.isTypeOnly = isTypeOnly; node.exportClause = exportClause; node.moduleSpecifier = moduleSpecifier; - node.assertClause = assertClause; - node.attributes = attributes; + node.attributes = node.assertClause = attributes; node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.exportClause) | propagateChildFlags(node.moduleSpecifier); @@ -5002,16 +4999,14 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, - assertClause: AssertClause | undefined, - attributes: ImportAttributes | undefined, + attributes: AssertClause | ImportAttributes | undefined, ) { return node.modifiers !== modifiers || node.isTypeOnly !== isTypeOnly || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier - || node.assertClause !== assertClause || node.attributes !== attributes - ? finishUpdateExportDeclaration(createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause, attributes), node) + ? finishUpdateExportDeclaration(createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes), node) : node; } @@ -7156,9 +7151,9 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : - isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.assertClause, node.attributes) : + isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.attributes) : isExportAssignment(node) ? updateExportAssignment(node, modifierArray, node.expression) : - isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause, node.attributes) : + isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.attributes) : Debug.assertNever(node); } diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index 3ba17063ecaf5..e952b614251c7 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -754,7 +754,6 @@ export function createExternalHelpersImportDeclarationIfNeeded(nodeFactory: Node /*modifiers*/ undefined, nodeFactory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, namedBindings), nodeFactory.createStringLiteral(externalHelpersModuleNameText), - /*assertClause*/ undefined, /*attributes*/ undefined, ); addInternalEmitFlags(externalHelpersImportDeclaration, InternalEmitFlags.NeverApplyImportHelper); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 554af31777515..b2fef995c44de 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -9,8 +9,6 @@ import { ArrayTypeNode, ArrowFunction, AsExpression, - AssertClause, - AssertEntry, AssertionLevel, AsteriskToken, attachFileToDiagnostics, @@ -124,7 +122,6 @@ import { ImportEqualsDeclaration, ImportOrExportSpecifier, ImportSpecifier, - ImportTypeAssertionContainer, ImportTypeAttributes, ImportTypeNode, IndexedAccessTypeNode, @@ -696,9 +693,6 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.qualifier) || visitNodes(cbNode, cbNodes, node.typeArguments); }, - [SyntaxKind.ImportTypeAssertionContainer]: function forEachChildInImportTypeAssertionContainer(node: ImportTypeAssertionContainer, cbNode: (node: Node) => T | undefined, _cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNode(cbNode, node.assertClause); - }, [SyntaxKind.ImportTypeAttributes]: function forEachChildInImportTypeAttributes(node: ImportTypeAttributes, cbNode: (node: Node) => T | undefined, _cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { return visitNode(cbNode, node.attributes); }, @@ -934,20 +928,12 @@ const forEachChildTable: ForEachChildTable = { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause) || visitNode(cbNode, node.attributes); }, [SyntaxKind.ImportClause]: function forEachChildInImportClause(node: ImportClause, cbNode: (node: Node) => T | undefined, _cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); }, - [SyntaxKind.AssertClause]: function forEachChildInAssertClause(node: AssertClause, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNodes(cbNode, cbNodes, node.elements); - }, - [SyntaxKind.AssertEntry]: function forEachChildInAssertEntry(node: AssertEntry, cbNode: (node: Node) => T | undefined, _cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.value); - }, [SyntaxKind.ImportAttributes]: function forEachChildInImportAttributes(node: ImportAttributes, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { return visitNodes(cbNode, cbNodes, node.elements); }, @@ -971,7 +957,6 @@ const forEachChildTable: ForEachChildTable = { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause) || visitNode(cbNode, node.attributes); }, [SyntaxKind.ImportSpecifier]: forEachChildInImportOrExportSpecifier, @@ -2698,9 +2683,8 @@ namespace Parser { token() === SyntaxKind.NumericLiteral; } - function isAssertionKey(): boolean { - return tokenIsIdentifierOrKeyword(token()) || - token() === SyntaxKind.StringLiteral; + function isImportAttributeName(): boolean { + return tokenIsIdentifierOrKeyword(token()) || token() === SyntaxKind.StringLiteral; } function parsePropertyNameWorker(allowComputedPropertyNames: boolean): PropertyName { @@ -2862,10 +2846,8 @@ namespace Parser { return isLiteralPropertyName(); case ParsingContext.ObjectBindingElements: return token() === SyntaxKind.OpenBracketToken || token() === SyntaxKind.DotDotDotToken || isLiteralPropertyName(); - case ParsingContext.AssertEntries: - return isAssertionKey(); case ParsingContext.ImportAttributes: - return isLiteralPropertyName(); + return isImportAttributeName(); 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. @@ -2996,7 +2978,6 @@ namespace Parser { case ParsingContext.ObjectLiteralMembers: case ParsingContext.ObjectBindingElements: case ParsingContext.ImportOrExportSpecifiers: - case ParsingContext.AssertEntries: case ParsingContext.ImportAttributes: return token() === SyntaxKind.CloseBraceToken; case ParsingContext.SwitchClauseStatements: @@ -3460,10 +3441,8 @@ namespace Parser { return parseErrorAtCurrentToken(Diagnostics.Identifier_expected); case ParsingContext.JsxChildren: return parseErrorAtCurrentToken(Diagnostics.Identifier_expected); - case ParsingContext.AssertEntries: - return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected); // AssertionKey. case ParsingContext.ImportAttributes: - return parseErrorAtCurrentToken(Diagnostics.Identifier_string_literal_or_number_literal_expected); // ImportAttributeName + return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected); case ParsingContext.JSDocComment: return parseErrorAtCurrentToken(Diagnostics.Identifier_expected); case ParsingContext.Count: @@ -4532,19 +4511,27 @@ namespace Parser { return token() === SyntaxKind.ImportKeyword; } - function parseImportTypeAssertions(pos: number, openBracePosition: number, multiLine: boolean): ImportTypeAssertionContainer { - parseExpected(SyntaxKind.AssertKeyword); - parseExpected(SyntaxKind.ColonToken); - const clause = parseAssertClause(/*skipAssertKeyword*/ true); - parseExpectedCloseBrace(openBracePosition); - return finishNode(factory.createImportTypeAssertionContainer(clause, multiLine), pos); - } - - function parseImportTypeAttributes(pos: number, openBracePosition: number, multiLine: boolean): ImportTypeAttributes { - parseExpected(SyntaxKind.WithKeyword); + function parseImportTypeAttributes(): ImportTypeAttributes { + const pos = getNodePos(); + const openBracePosition = scanner.getTokenStart(); + parseExpected(SyntaxKind.OpenBraceToken); + const multiLine = scanner.hasPrecedingLineBreak(); + const currentToken = token(); + if (currentToken !== SyntaxKind.WithKeyword && currentToken !== SyntaxKind.AssertKeyword) { + parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(SyntaxKind.WithKeyword)); + } + nextToken(); parseExpected(SyntaxKind.ColonToken); - const attributes = parseImportAttributes(/*skipWithKeyword*/ true); - parseExpectedCloseBrace(openBracePosition); + const attributes = parseImportAttributes(currentToken as SyntaxKind.WithKeyword | SyntaxKind.AssertKeyword, /*shouldAdvance*/ false); + if (!parseExpected(SyntaxKind.CloseBraceToken)) { + const lastError = lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === Diagnostics._0_expected.code) { + addRelatedInfo( + lastError, + createDetachedDiagnostic(fileName, sourceText, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"), + ); + } + } return finishNode(factory.createImportTypeAttributes(attributes, multiLine), pos); } @@ -4555,36 +4542,14 @@ namespace Parser { parseExpected(SyntaxKind.ImportKeyword); parseExpected(SyntaxKind.OpenParenToken); const type = parseType(); - let assertions: ImportTypeAssertionContainer | undefined; let attributes: ImportTypeAttributes | undefined; if (parseOptional(SyntaxKind.CommaToken)) { - const startPos = getNodePos(); - const openBracePos = scanner.getTokenStart(); - parseExpected(SyntaxKind.OpenBraceToken); - const multiLine = scanner.hasPrecedingLineBreak(); - if (token() === SyntaxKind.AssertKeyword) { - assertions = parseImportTypeAssertions(startPos, openBracePos, multiLine); - } - else { - attributes = parseImportTypeAttributes(startPos, openBracePos, multiLine); - } + attributes = parseImportTypeAttributes(); } parseExpected(SyntaxKind.CloseParenToken); const qualifier = parseOptional(SyntaxKind.DotToken) ? parseEntityNameOfTypeReference() : undefined; const typeArguments = parseTypeArgumentsOfTypeReference(); - return finishNode(factory.createImportTypeNode(type, assertions, attributes, qualifier, typeArguments, isTypeOf), pos); - } - - function parseExpectedCloseBrace(pos: number) { - if (!parseExpected(SyntaxKind.CloseBraceToken)) { - const lastError = lastOrUndefined(parseDiagnostics); - if (lastError && lastError.code === Diagnostics._0_expected.code) { - addRelatedInfo( - lastError, - createDetachedDiagnostic(fileName, sourceText, pos, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"), - ); - } - } + return finishNode(factory.createImportTypeNode(type, attributes, qualifier, typeArguments, isTypeOf), pos); } function nextTokenIsNumericOrBigIntLiteral() { @@ -8396,71 +8361,28 @@ namespace Parser { parseExpected(SyntaxKind.FromKeyword); } const moduleSpecifier = parseModuleSpecifier(); - let assertClause: AssertClause | undefined; - if (token() === SyntaxKind.AssertKeyword && !scanner.hasPrecedingLineBreak()) { - assertClause = parseAssertClause(); - } + const currentToken = token(); let attributes: ImportAttributes | undefined; - if (assertClause === undefined && token() === SyntaxKind.WithKeyword) { - attributes = parseImportAttributes(); + if (currentToken === SyntaxKind.WithKeyword || currentToken === SyntaxKind.AssertKeyword) { + attributes = parseImportAttributes(currentToken); } parseSemicolon(); - const node = factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause, attributes); + const node = factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes); return withJSDoc(finishNode(node, pos), hasJSDoc); } - function parseAssertEntry() { + function parseImportAttribute() { const pos = getNodePos(); const name = tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(SyntaxKind.StringLiteral) as StringLiteral; parseExpected(SyntaxKind.ColonToken); const value = parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true); - return finishNode(factory.createAssertEntry(name, value), pos); + return finishNode(factory.createImportAttribute(name, value), pos); } - function parseAssertClause(skipAssertKeyword?: true) { + function parseImportAttributes(token: SyntaxKind.AssertKeyword | SyntaxKind.WithKeyword, shouldAdvance = true) { const pos = getNodePos(); - if (!skipAssertKeyword) { - parseExpected(SyntaxKind.AssertKeyword); - } - const openBracePosition = scanner.getTokenStart(); - if (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, sourceText, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"), - ); - } - } - return finishNode(factory.createAssertClause(elements, multiLine), pos); - } - else { - const elements = createNodeArray([], getNodePos(), /*end*/ undefined, /*hasTrailingComma*/ false); - return finishNode(factory.createAssertClause(elements, /*multiLine*/ false), pos); - } - } - - function parseImportAttributeName() { - if (token() === SyntaxKind.StringLiteral || token() === SyntaxKind.NumericLiteral) { - return parseLiteralLikeNode(token()) as StringLiteral | NumericLiteral; - } - return parseIdentifierName(); - } - - function parseImportAttribute() { - const pos = getNodePos(); - const name = parseImportAttributeName(); - parseExpected(SyntaxKind.ColonToken); - return finishNode(factory.createImportAttribute(name, parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true)), pos); - } - - function parseImportAttributes(skipWithKeyword?: true) { - const pos = getNodePos(); - if (!skipWithKeyword) { - parseExpected(SyntaxKind.WithKeyword); + if (shouldAdvance) { + nextToken(); } const openBracePosition = scanner.getTokenStart(); if (parseExpected(SyntaxKind.OpenBraceToken)) { @@ -8475,11 +8397,11 @@ namespace Parser { ); } } - return finishNode(factory.createImportAttributes(elements, multiLine), pos); + return finishNode(factory.createImportAttributes(token, elements, multiLine), pos); } else { const elements = createNodeArray([], getNodePos(), /*end*/ undefined, /*hasTrailingComma*/ false); - return finishNode(factory.createImportAttributes(elements, /*multiLine*/ false), pos); + return finishNode(factory.createImportAttributes(token, elements, /*multiLine*/ false), pos); } } @@ -8682,7 +8604,6 @@ namespace Parser { setAwaitContext(/*value*/ true); let exportClause: NamedExportBindings | undefined; let moduleSpecifier: Expression | undefined; - let assertClause: AssertClause | undefined; let attributes: ImportAttributes | undefined; const isTypeOnly = parseOptional(SyntaxKind.TypeKeyword); const namespaceExportPos = getNodePos(); @@ -8703,15 +8624,13 @@ namespace Parser { moduleSpecifier = parseModuleSpecifier(); } } - if (moduleSpecifier && token() === SyntaxKind.AssertKeyword && !scanner.hasPrecedingLineBreak()) { - assertClause = parseAssertClause(); - } - if (assertClause === undefined && moduleSpecifier && token() === SyntaxKind.WithKeyword) { - attributes = parseImportAttributes(); + const currentToken = token(); + if (moduleSpecifier && (currentToken === SyntaxKind.WithKeyword || currentToken === SyntaxKind.AssertKeyword)) { + attributes = parseImportAttributes(currentToken); } parseSemicolon(); setAwaitContext(savedAwaitContext); - const node = factory.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause, attributes); + const node = factory.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes); return withJSDoc(finishNode(node, pos), hasJSDoc); } @@ -8758,7 +8677,6 @@ namespace Parser { 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, - /** @deprecated */ AssertEntries, // Import entries list ImportAttributes, // Import attributes JSDocComment, // Parsing via JSDocParser Count, // Number of parsing contexts diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 4901a8c3290c0..0d86402d08f42 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -902,14 +902,14 @@ export function getModeForUsageLocation(file: { impliedNodeFormat?: ResolutionMo if ((isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent))) { const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent); if (isTypeOnly) { - const override = getResolutionModeOverride(usage.parent.attributes || usage.parent.assertClause); + const override = getResolutionModeOverride(usage.parent.attributes); if (override) { return override; } } } if (usage.parent.parent && isImportTypeNode(usage.parent.parent)) { - const override = getResolutionModeOverride(usage.parent.parent.attributes?.attributes || usage.parent.parent.assertions?.assertClause); + const override = getResolutionModeOverride(usage.parent.parent.attributes?.attributes); if (override) { return override; } @@ -3301,7 +3301,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg function createSyntheticImport(text: string, file: SourceFile) { const externalHelpersModuleReference = factory.createStringLiteral(text); - const importDecl = factory.createImportDeclaration(/*modifiers*/ undefined, /*importClause*/ undefined, externalHelpersModuleReference, /*assertClause*/ undefined, /*attributes*/ undefined); + const importDecl = factory.createImportDeclaration(/*modifiers*/ undefined, /*importClause*/ undefined, externalHelpersModuleReference, /*attributes*/ undefined); addInternalEmitFlags(importDecl, InternalEmitFlags.NeverApplyImportHelper); setParent(externalHelpersModuleReference, importDecl); setParent(importDecl, file); diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 164b61eeb3798..05b5ad1c8b9b4 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -6,7 +6,6 @@ import { append, ArrayBindingElement, arrayFrom, - AssertClause, BindingElement, BindingName, BindingPattern, @@ -978,7 +977,6 @@ export function transformDeclarations(context: TransformationContext) { decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier), - tryGetResolutionModeOverride(decl.assertClause), tryGetResolutionModeOverride(decl.attributes), ); } @@ -996,7 +994,6 @@ export function transformDeclarations(context: TransformationContext) { /*namedBindings*/ undefined, ), rewriteModuleSpecifier(decl, decl.moduleSpecifier), - tryGetResolutionModeOverride(decl.assertClause), tryGetResolutionModeOverride(decl.attributes), ); } @@ -1013,7 +1010,6 @@ export function transformDeclarations(context: TransformationContext) { namedBindings, ), rewriteModuleSpecifier(decl, decl.moduleSpecifier), - tryGetResolutionModeOverride(decl.assertClause), tryGetResolutionModeOverride(decl.attributes), ) : undefined; } @@ -1030,7 +1026,6 @@ export function transformDeclarations(context: TransformationContext) { bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined, ), rewriteModuleSpecifier(decl, decl.moduleSpecifier), - tryGetResolutionModeOverride(decl.assertClause), tryGetResolutionModeOverride(decl.attributes), ); } @@ -1041,14 +1036,13 @@ export function transformDeclarations(context: TransformationContext) { decl.modifiers, /*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier), - tryGetResolutionModeOverride(decl.assertClause), tryGetResolutionModeOverride(decl.attributes), ); } // Nothing visible } - function tryGetResolutionModeOverride(node: T | undefined) { + function tryGetResolutionModeOverride(node: ImportAttributes | undefined) { const mode = getResolutionModeOverride(node); return node && mode !== undefined ? node : undefined; } @@ -1321,7 +1315,6 @@ export function transformDeclarations(context: TransformationContext) { return cleanup(factory.updateImportTypeNode( input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), - input.assertions, input.attributes, input.qualifier, visitNodes(input.typeArguments, visitDeclarationSubtree, isTypeNode), @@ -1384,7 +1377,6 @@ export function transformDeclarations(context: TransformationContext) { input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), - tryGetResolutionModeOverride(input.assertClause), tryGetResolutionModeOverride(input.attributes), ); } diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index ff2e0e30f91e1..a71edbe2baeb6 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -170,7 +170,7 @@ export function transformJsx(context: TransformationContext): (x: SourceFile | B for (const [importSource, importSpecifiersMap] of arrayFrom(currentFileState.utilizedImplicitRuntimeImports.entries())) { if (isExternalModule(node)) { // Add `import` statement - const importStatement = factory.createImportDeclaration(/*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, factory.createNamedImports(arrayFrom(importSpecifiersMap.values()))), factory.createStringLiteral(importSource), /*assertClause*/ undefined, /*attributes*/ undefined); + const importStatement = factory.createImportDeclaration(/*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, factory.createNamedImports(arrayFrom(importSpecifiersMap.values()))), factory.createStringLiteral(importSource), /*attributes*/ undefined); setParentRecursive(importStatement, /*incremental*/ false); statements = insertStatementAfterCustomPrologue(statements.slice(), importStatement); } diff --git a/src/compiler/transformers/module/esnextAnd2015.ts b/src/compiler/transformers/module/esnextAnd2015.ts index ffc283307f733..b99185231a892 100644 --- a/src/compiler/transformers/module/esnextAnd2015.ts +++ b/src/compiler/transformers/module/esnextAnd2015.ts @@ -159,7 +159,6 @@ export function transformECMAScriptModule(context: TransformationContext): (x: S ]), ), factory.createStringLiteral("module"), - /*assertClause*/ undefined, /*attributes*/ undefined, ); const requireHelperName = factory.createUniqueName("__require", GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel); @@ -267,7 +266,6 @@ export function transformECMAScriptModule(context: TransformationContext): (x: S ), ), node.moduleSpecifier, - node.assertClause, node.attributes, ); setOriginalNode(importDecl, node.exportClause); diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 52f81f174d0f6..584cf837e180a 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -2227,7 +2227,6 @@ export function transformTypeScript(context: TransformationContext) { /*modifiers*/ undefined, importClause, node.moduleSpecifier, - node.assertClause, node.attributes, ) : undefined; @@ -2324,7 +2323,6 @@ export function transformTypeScript(context: TransformationContext) { node.isTypeOnly, exportClause, node.moduleSpecifier, - node.assertClause, node.attributes, ) : undefined; @@ -2395,7 +2393,6 @@ export function transformTypeScript(context: TransformationContext) { /*modifiers*/ undefined, /*importClause*/ undefined, node.moduleReference.expression, - /*assertClause*/ undefined, /*attributes*/ undefined, ), node, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 147fdfe4b9cdd..8ee858d031b43 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -376,12 +376,13 @@ export const enum SyntaxKind { DefaultClause, HeritageClause, CatchClause, - /** @deprecated */ AssertClause, - /** @deprecated */ AssertEntry, - /** @deprecated */ ImportTypeAssertionContainer, + ImportAttributes, ImportAttribute, ImportTypeAttributes, + /** @deprecated */ AssertClause = ImportAttributes, + /** @deprecated */ AssertEntry = ImportAttribute, + /** @deprecated */ ImportTypeAssertionContainer = ImportTypeAttributes, // Property assignments PropertyAssignment, @@ -2148,16 +2149,12 @@ export interface KeywordTypeNode; - readonly multiLine?: boolean; -} +export type AssertClause = ImportAttributes; -export type ImportAttributeName = Identifier | StringLiteral | NumericLiteral; +export type ImportAttributeName = Identifier | StringLiteral; export interface ImportAttribute extends Node { readonly kind: SyntaxKind.ImportAttribute; @@ -3672,6 +3659,7 @@ export interface ImportAttribute extends Node { } export interface ImportAttributes extends Node { + readonly token: SyntaxKind.WithKeyword | SyntaxKind.AssertKeyword; readonly kind: SyntaxKind.ImportAttributes; readonly parent: ImportDeclaration | ExportDeclaration; readonly elements: NodeArray; @@ -8437,8 +8425,10 @@ export interface NodeFactory { updateConditionalTypeNode(node: ConditionalTypeNode, checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode; createInferTypeNode(typeParameter: TypeParameterDeclaration): InferTypeNode; updateInferTypeNode(node: InferTypeNode, typeParameter: TypeParameterDeclaration): InferTypeNode; - createImportTypeNode(argument: TypeNode, assertions?: ImportTypeAssertionContainer, attributes?: ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; - updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, assertions: ImportTypeAssertionContainer | undefined, attributes: ImportTypeAttributes | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode; + /** @deprecated */ createImportTypeNode(argument: TypeNode, attributes?: ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; + createImportTypeNode(argument: TypeNode, attributes?: ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; + /** @deprecated */ updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, assertions: ImportTypeAssertionContainer | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode; + updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, attributes: ImportTypeAttributes | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode; createParenthesizedType(type: TypeNode): ParenthesizedTypeNode; updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode; createThisTypeNode(): ThisTypeNode; @@ -8618,8 +8608,8 @@ export interface NodeFactory { updateNamespaceExportDeclaration(node: NamespaceExportDeclaration, name: Identifier): NamespaceExportDeclaration; createImportEqualsDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; updateImportEqualsDeclaration(node: ImportEqualsDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; - createImportDeclaration(modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause, attributes?: ImportAttributes): ImportDeclaration; - updateImportDeclaration(node: ImportDeclaration, modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined, attributes: ImportAttributes | undefined): ImportDeclaration; + createImportDeclaration(modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, attributes?: ImportAttributes): ImportDeclaration; + updateImportDeclaration(node: ImportDeclaration, modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, attributes: ImportAttributes | undefined): ImportDeclaration; createImportClause(isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause; updateImportClause(node: ImportClause, isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause; /** @deprecated */ createAssertClause(elements: NodeArray, multiLine?: boolean): AssertClause; @@ -8628,7 +8618,7 @@ export interface NodeFactory { /** @deprecated */ updateAssertEntry(node: AssertEntry, name: AssertionKey, value: Expression): AssertEntry; /** @deprecated */ createImportTypeAssertionContainer(clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; /** @deprecated */ updateImportTypeAssertionContainer(node: ImportTypeAssertionContainer, clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; - createImportAttributes(elements: NodeArray, multiLine?: boolean): ImportAttributes; + createImportAttributes(token: ImportAttributes["token"], elements: NodeArray, multiLine?: boolean): ImportAttributes; updateImportAttributes(node: ImportAttributes, elements: NodeArray, multiLine?: boolean): ImportAttributes; createImportAttribute(name: ImportAttributeName, value: Expression): ImportAttribute; updateImportAttribute(node: ImportAttribute, name: ImportAttributeName, value: Expression): ImportAttribute; @@ -8644,8 +8634,8 @@ export interface NodeFactory { updateImportSpecifier(node: ImportSpecifier, isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; createExportAssignment(modifiers: readonly ModifierLike[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment; updateExportAssignment(node: ExportAssignment, modifiers: readonly ModifierLike[] | undefined, expression: Expression): ExportAssignment; - createExportDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause, attributes?: ImportAttributes): ExportDeclaration; - updateExportDeclaration(node: ExportDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined, attributes: ImportAttributes | undefined): ExportDeclaration; + createExportDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, attributes?: ImportAttributes): ExportDeclaration; + updateExportDeclaration(node: ExportDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, attributes: ImportAttributes | undefined): ExportDeclaration; createNamedExports(elements: readonly ExportSpecifier[]): NamedExports; updateNamedExports(node: NamedExports, elements: readonly ExportSpecifier[]): NamedExports; createExportSpecifier(isTypeOnly: boolean, propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier; @@ -9773,8 +9763,8 @@ export const enum ListFormat { ObjectBindingPatternElements = SingleLine | AllowTrailingComma | SpaceBetweenBraces | CommaDelimited | SpaceBetweenSiblings | NoSpaceIfEmpty, ArrayBindingPatternElements = SingleLine | AllowTrailingComma | CommaDelimited | SpaceBetweenSiblings | NoSpaceIfEmpty, ObjectLiteralExpressionProperties = PreserveLines | CommaDelimited | SpaceBetweenSiblings | SpaceBetweenBraces | Indented | Braces | NoSpaceIfEmpty, - /** @deprecated */ ImportClauseEntries = PreserveLines | CommaDelimited | SpaceBetweenSiblings | SpaceBetweenBraces | Indented | Braces | NoSpaceIfEmpty, ImportAttributes = PreserveLines | CommaDelimited | SpaceBetweenSiblings | SpaceBetweenBraces | Indented | Braces | NoSpaceIfEmpty, + /** @deprecated */ ImportClauseEntries = ImportAttributes, ArrayLiteralExpressionElements = PreserveLines | CommaDelimited | SpaceBetweenSiblings | AllowTrailingComma | Indented | SquareBrackets, CommaListElements = CommaDelimited | SpaceBetweenSiblings | SingleLine, CallExpressionArguments = CommaDelimited | SpaceBetweenSiblings | SingleLine | Parenthesis, diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 4fedb2245222d..4556af18b0099 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -10458,7 +10458,5 @@ export function hasResolutionModeOverride(node: ImportTypeNode | ImportDeclarati if (node === undefined) { return false; } - const assertClause = isImportTypeNode(node) ? node.assertions?.assertClause : node.assertClause; - const attributes = isImportTypeNode(node) ? node.attributes?.attributes : node.attributes; - return !!getResolutionModeOverride(attributes || assertClause); + return !!getResolutionModeOverride(isImportTypeNode(node) ? node.attributes?.attributes : node.attributes); } diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 6b736990594e2..6321b0f314a04 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -6,7 +6,6 @@ import { ArrayBindingOrAssignmentElement, ArrayBindingOrAssignmentPattern, AssertionExpression, - AssertionKey, AssignmentDeclarationKind, AssignmentPattern, AutoAccessorPropertyDeclaration, @@ -147,7 +146,6 @@ import { isModuleBlock, isNonNullExpression, isNotEmittedStatement, - isNumericLiteral, isOmittedExpression, isParameter, isPartiallyEmittedExpression, @@ -1520,16 +1518,12 @@ export function isTypeOnlyImportOrExportDeclaration(node: Node): node is TypeOnl return isTypeOnlyImportDeclaration(node) || isTypeOnlyExportDeclaration(node); } -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); } export function isImportAttributeName(node: Node): node is ImportAttributeName { - return isStringLiteral(node) || isIdentifier(node) || isNumericLiteral(node); + return isStringLiteral(node) || isIdentifier(node); } // Identifiers diff --git a/src/compiler/visitorPublic.ts b/src/compiler/visitorPublic.ts index 30790eefb9819..963beb15459a1 100644 --- a/src/compiler/visitorPublic.ts +++ b/src/compiler/visitorPublic.ts @@ -11,9 +11,6 @@ import { Identifier, isArray, isArrayBindingElement, - isAssertClause, - isAssertEntry, - isAssertionKey, isAssertsKeyword, isAsteriskToken, isAwaitKeyword, @@ -47,7 +44,6 @@ import { isImportAttributes, isImportClause, isImportSpecifier, - isImportTypeAssertionContainer, isImportTypeAttributes, isJsxAttributeLike, isJsxAttributeName, @@ -898,7 +894,6 @@ const visitEachChildTable: VisitEachChildTable = { return context.factory.updateImportTypeNode( node, Debug.checkDefined(nodeVisitor(node.argument, visitor, isTypeNode)), - nodeVisitor(node.assertions, visitor, isImportTypeAssertionContainer), nodeVisitor(node.attributes, visitor, isImportTypeAttributes), nodeVisitor(node.qualifier, visitor, isEntityName), nodesVisitor(node.typeArguments, visitor, isTypeNode), @@ -914,14 +909,6 @@ const visitEachChildTable: VisitEachChildTable = { ); }, - [SyntaxKind.ImportTypeAssertionContainer]: function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateImportTypeAssertionContainer( - node, - Debug.checkDefined(nodeVisitor(node.assertClause, visitor, isAssertClause)), - node.multiLine, - ); - }, - [SyntaxKind.NamedTupleMember]: function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateNamedTupleMember( node, @@ -1537,27 +1524,10 @@ const visitEachChildTable: VisitEachChildTable = { nodesVisitor(node.modifiers, visitor, isModifierLike), nodeVisitor(node.importClause, visitor, isImportClause), Debug.checkDefined(nodeVisitor(node.moduleSpecifier, visitor, isExpression)), - nodeVisitor(node.assertClause, visitor, isAssertClause), nodeVisitor(node.attributes, visitor, isImportAttributes), ); }, - [SyntaxKind.AssertClause]: function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { - return context.factory.updateAssertClause( - node, - nodesVisitor(node.elements, visitor, isAssertEntry), - node.multiLine, - ); - }, - - [SyntaxKind.AssertEntry]: function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateAssertEntry( - node, - Debug.checkDefined(nodeVisitor(node.name, visitor, isAssertionKey)), - Debug.checkDefined(nodeVisitor(node.value, visitor, isExpression)), - ); - }, - [SyntaxKind.ImportAttributes]: function visitEachChildOfImportAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateImportAttributes( node, @@ -1628,7 +1598,6 @@ const visitEachChildTable: VisitEachChildTable = { node.isTypeOnly, nodeVisitor(node.exportClause, visitor, isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, isExpression), - nodeVisitor(node.assertClause, visitor, isAssertClause), nodeVisitor(node.attributes, visitor, isImportAttributes), ); }, diff --git a/src/services/codefixes/convertToTypeOnlyExport.ts b/src/services/codefixes/convertToTypeOnlyExport.ts index f67151547f1b8..14ec2e3e8e31d 100644 --- a/src/services/codefixes/convertToTypeOnlyExport.ts +++ b/src/services/codefixes/convertToTypeOnlyExport.ts @@ -68,7 +68,6 @@ function fixSingleExportDeclaration(changes: textChanges.ChangeTracker, exportSp /*isTypeOnly*/ false, factory.updateNamedExports(exportClause, filter(exportClause.elements, e => !contains(typeExportSpecifiers, e))), exportDeclaration.moduleSpecifier, - /*assertClause*/ undefined, /*attributes*/ undefined, ); const typeExportDeclaration = factory.createExportDeclaration( @@ -76,7 +75,6 @@ function fixSingleExportDeclaration(changes: textChanges.ChangeTracker, exportSp /*isTypeOnly*/ true, factory.createNamedExports(typeExportSpecifiers), exportDeclaration.moduleSpecifier, - /*assertClause*/ undefined, /*attributes*/ undefined, ); diff --git a/src/services/codefixes/convertToTypeOnlyImport.ts b/src/services/codefixes/convertToTypeOnlyImport.ts index 210eb3bfe50e4..43ebf3e7ac6bc 100644 --- a/src/services/codefixes/convertToTypeOnlyImport.ts +++ b/src/services/codefixes/convertToTypeOnlyImport.ts @@ -125,14 +125,12 @@ function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, de getSynthesizedDeepClones(declaration.modifiers, /*includeTrivia*/ true), factory.createImportClause(/*isTypeOnly*/ true, getSynthesizedDeepClone(importClause.name, /*includeTrivia*/ true), /*namedBindings*/ undefined), getSynthesizedDeepClone(declaration.moduleSpecifier, /*includeTrivia*/ true), - getSynthesizedDeepClone(declaration.assertClause, /*includeTrivia*/ true), getSynthesizedDeepClone(declaration.attributes, /*includeTrivia*/ true), ), factory.createImportDeclaration( getSynthesizedDeepClones(declaration.modifiers, /*includeTrivia*/ true), factory.createImportClause(/*isTypeOnly*/ true, /*name*/ undefined, getSynthesizedDeepClone(importClause.namedBindings, /*includeTrivia*/ true)), getSynthesizedDeepClone(declaration.moduleSpecifier, /*includeTrivia*/ true), - getSynthesizedDeepClone(declaration.assertClause, /*includeTrivia*/ true), getSynthesizedDeepClone(declaration.attributes, /*includeTrivia*/ true), ), ]); @@ -144,7 +142,7 @@ function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, de sameMap(importClause.namedBindings.elements, e => factory.updateImportSpecifier(e, /*isTypeOnly*/ false, e.propertyName, e.name)), ) : importClause.namedBindings; - const importDeclaration = factory.updateImportDeclaration(declaration, declaration.modifiers, factory.updateImportClause(importClause, /*isTypeOnly*/ true, importClause.name, newNamedBindings), declaration.moduleSpecifier, declaration.assertClause, declaration.attributes); + const importDeclaration = factory.updateImportDeclaration(declaration, declaration.modifiers, factory.updateImportClause(importClause, /*isTypeOnly*/ true, importClause.name, newNamedBindings), declaration.moduleSpecifier, declaration.attributes); changes.replaceNode(sourceFile, declaration, importDeclaration); } } diff --git a/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts b/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts index 12ff253cd522e..1523819f60190 100644 --- a/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts +++ b/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts @@ -38,6 +38,6 @@ function getImportTypeNode(sourceFile: SourceFile, pos: number): ImportTypeNode } function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, importType: ImportTypeNode) { - const newTypeNode = factory.updateImportTypeNode(importType, importType.argument, importType.assertions, importType.attributes, importType.qualifier, importType.typeArguments, /*isTypeOf*/ true); + const newTypeNode = factory.updateImportTypeNode(importType, importType.argument, importType.attributes, importType.qualifier, importType.typeArguments, /*isTypeOf*/ true); changes.replaceNode(sourceFile, importType, newTypeNode); } diff --git a/src/services/codefixes/fixImportNonExportedMember.ts b/src/services/codefixes/fixImportNonExportedMember.ts index 7ebda0a72f742..16587c5a64676 100644 --- a/src/services/codefixes/fixImportNonExportedMember.ts +++ b/src/services/codefixes/fixImportNonExportedMember.ts @@ -185,14 +185,13 @@ function updateExport(changes: textChanges.ChangeTracker, program: Program, sour factory.createNodeArray([...namedExports, ...createExportSpecifiers(names, allowTypeModifier)], /*hasTrailingComma*/ namedExports.hasTrailingComma), ), node.moduleSpecifier, - node.assertClause, node.attributes, ), ); } function createExport(changes: textChanges.ChangeTracker, program: Program, sourceFile: SourceFile, names: ExportName[]) { - changes.insertNodeAtEndOfScope(sourceFile, sourceFile, factory.createExportDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, factory.createNamedExports(createExportSpecifiers(names, /*allowTypeModifier*/ getIsolatedModules(program.getCompilerOptions()))), /*moduleSpecifier*/ undefined, /*assertClause*/ undefined, /*attributes*/ undefined)); + changes.insertNodeAtEndOfScope(sourceFile, sourceFile, factory.createExportDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, factory.createNamedExports(createExportSpecifiers(names, /*allowTypeModifier*/ getIsolatedModules(program.getCompilerOptions()))), /*moduleSpecifier*/ undefined, /*attributes*/ undefined)); } function createExportSpecifiers(names: ExportName[], allowTypeModifier: boolean) { diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 8e6eefb5d36c1..965153f8e51d4 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -1625,7 +1625,6 @@ function getNewImports( factory.createNamespaceImport(factory.createIdentifier(namespaceLikeImport.name)), ), quotedModuleSpecifier, - /*assertClause*/ undefined, /*attributes*/ undefined, ); statements = combine(statements, declaration); diff --git a/src/services/codefixes/requireInTs.ts b/src/services/codefixes/requireInTs.ts index d8522a31235ec..1c385d5ed0e19 100644 --- a/src/services/codefixes/requireInTs.ts +++ b/src/services/codefixes/requireInTs.ts @@ -57,7 +57,7 @@ function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, in statement, defaultImportName && !allowSyntheticDefaults ? factory.createImportEqualsDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, defaultImportName, factory.createExternalModuleReference(required)) - : factory.createImportDeclaration(/*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, defaultImportName, namedImports), required, /*assertClause*/ undefined, /*attributes*/ undefined), + : factory.createImportDeclaration(/*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, defaultImportName, namedImports), required, /*attributes*/ undefined), ); } diff --git a/src/services/codefixes/splitTypeOnlyImport.ts b/src/services/codefixes/splitTypeOnlyImport.ts index 958b260dfe825..8ceba91300fbe 100644 --- a/src/services/codefixes/splitTypeOnlyImport.ts +++ b/src/services/codefixes/splitTypeOnlyImport.ts @@ -53,7 +53,6 @@ function splitTypeOnlyImport(changes: textChanges.ChangeTracker, importDeclarati importDeclaration.modifiers, factory.updateImportClause(importClause, importClause.isTypeOnly, importClause.name, /*namedBindings*/ undefined), importDeclaration.moduleSpecifier, - importDeclaration.assertClause, importDeclaration.attributes, ), ); @@ -65,7 +64,6 @@ function splitTypeOnlyImport(changes: textChanges.ChangeTracker, importDeclarati /*modifiers*/ undefined, factory.updateImportClause(importClause, importClause.isTypeOnly, /*name*/ undefined, importClause.namedBindings), importDeclaration.moduleSpecifier, - importDeclaration.assertClause, importDeclaration.attributes, ), ); diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts index a729716ab4596..777541679b7da 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -269,7 +269,6 @@ function removeUnusedImports(oldImports: readonly ImportDeclaration[], sourceFil importDecl.modifiers, /*importClause*/ undefined, moduleSpecifier, - /*assertClause*/ undefined, /*attributes*/ undefined, )); } @@ -531,7 +530,6 @@ function coalesceExportsWorker(exportGroup: readonly ExportDeclaration[], compar factory.updateNamespaceExport(exportDecl.exportClause, exportDecl.exportClause.name) ), exportDecl.moduleSpecifier, - exportDecl.assertClause, exportDecl.attributes, ), ); @@ -581,7 +579,6 @@ function updateImportDeclarationAndClause( importDeclaration.modifiers, factory.updateImportClause(importDeclaration.importClause!, importDeclaration.importClause!.isTypeOnly, name, namedBindings), // TODO: GH#18217 importDeclaration.moduleSpecifier, - importDeclaration.assertClause, importDeclaration.attributes, ); } diff --git a/src/services/refactors/convertExport.ts b/src/services/refactors/convertExport.ts index 50b8a42aa79bf..7f477fc1a86ac 100644 --- a/src/services/refactors/convertExport.ts +++ b/src/services/refactors/convertExport.ts @@ -275,7 +275,7 @@ function changeDefaultToNamedImport(importingSourceFile: SourceFile, ref: Identi } case SyntaxKind.ImportType: const importTypeNode = parent as ImportTypeNode; - changes.replaceNode(importingSourceFile, parent, factory.createImportTypeNode(importTypeNode.argument, importTypeNode.assertions, importTypeNode.attributes, factory.createIdentifier(exportName), importTypeNode.typeArguments, importTypeNode.isTypeOf)); + changes.replaceNode(importingSourceFile, parent, factory.createImportTypeNode(importTypeNode.argument, importTypeNode.attributes, factory.createIdentifier(exportName), importTypeNode.typeArguments, importTypeNode.isTypeOf)); break; default: Debug.failBadSyntaxKind(parent); diff --git a/src/services/refactors/convertImport.ts b/src/services/refactors/convertImport.ts index 47d7314de7139..5e6ac06ec846d 100644 --- a/src/services/refactors/convertImport.ts +++ b/src/services/refactors/convertImport.ts @@ -280,5 +280,5 @@ function isExportEqualsModule(moduleSpecifier: Expression, checker: TypeChecker) } function updateImport(old: ImportDeclaration, defaultImportName: Identifier | undefined, elements: readonly ImportSpecifier[] | undefined): ImportDeclaration { - return factory.createImportDeclaration(/*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, defaultImportName, elements && elements.length ? factory.createNamedImports(elements) : undefined), old.moduleSpecifier, /*assertClause*/ undefined, /*attributes*/ undefined); + return factory.createImportDeclaration(/*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, defaultImportName, elements && elements.length ? factory.createNamedImports(elements) : undefined), old.moduleSpecifier, /*attributes*/ undefined); } diff --git a/src/services/refactors/moveToFile.ts b/src/services/refactors/moveToFile.ts index bc0287edcf2b1..967d12180611b 100644 --- a/src/services/refactors/moveToFile.ts +++ b/src/services/refactors/moveToFile.ts @@ -479,7 +479,6 @@ function updateNamespaceLikeImportNode(node: SupportedImport, newNamespaceName: /*modifiers*/ undefined, factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, factory.createNamespaceImport(newNamespaceId)), newModuleString, - /*assertClause*/ undefined, /*attributes*/ undefined, ); case SyntaxKind.ImportEqualsDeclaration: @@ -773,7 +772,7 @@ export function filterImport(i: SupportedImport, moduleSpecifier: StringLiteralL const defaultImport = clause.name && keep(clause.name) ? clause.name : undefined; const namedBindings = clause.namedBindings && filterNamedBindings(clause.namedBindings, keep); return defaultImport || namedBindings - ? factory.createImportDeclaration(/*modifiers*/ undefined, factory.createImportClause(clause.isTypeOnly, defaultImport, namedBindings), getSynthesizedDeepClone(moduleSpecifier), /*assertClause*/ undefined, /*attributes*/ undefined) + ? factory.createImportDeclaration(/*modifiers*/ undefined, factory.createImportClause(clause.isTypeOnly, defaultImport, namedBindings), getSynthesizedDeepClone(moduleSpecifier), /*attributes*/ undefined) : undefined; } case SyntaxKind.ImportEqualsDeclaration: @@ -1199,7 +1198,7 @@ function moveStatementsToTargetFile(changes: textChanges.ChangeTracker, program: } if (length(updatedElements) < length(elements)) { - changes.replaceNode(targetFile, exportDeclaration, factory.updateExportDeclaration(exportDeclaration, exportDeclaration.modifiers, exportDeclaration.isTypeOnly, factory.updateNamedExports(exportDeclaration.exportClause, factory.createNodeArray(updatedElements, elements.hasTrailingComma)), exportDeclaration.moduleSpecifier, exportDeclaration.assertClause, exportDeclaration.attributes)); + changes.replaceNode(targetFile, exportDeclaration, factory.updateExportDeclaration(exportDeclaration, exportDeclaration.modifiers, exportDeclaration.isTypeOnly, factory.updateNamedExports(exportDeclaration.exportClause, factory.createNodeArray(updatedElements, elements.hasTrailingComma)), exportDeclaration.moduleSpecifier, exportDeclaration.attributes)); } } } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index c184d703caf6b..cc6d17e9d2421 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -2500,7 +2500,6 @@ export function makeImport(defaultImport: Identifier | undefined, namedImports: ? factory.createImportClause(!!isTypeOnly, defaultImport, namedImports && namedImports.length ? factory.createNamedImports(namedImports) : undefined) : undefined, typeof moduleSpecifier === "string" ? makeStringLiteral(moduleSpecifier, quotePreference) : moduleSpecifier, - /*assertClause*/ undefined, /*attributes*/ undefined, ); } diff --git a/src/testRunner/unittests/transform.ts b/src/testRunner/unittests/transform.ts index a6021856579ac..c56721a2c9ca4 100644 --- a/src/testRunner/unittests/transform.ts +++ b/src/testRunner/unittests/transform.ts @@ -309,7 +309,7 @@ describe("unittests:: TransformAPI", () => { const exports = [{ name: "x" }]; const exportSpecifiers = exports.map(e => ts.factory.createExportSpecifier(/*isTypeOnly*/ false, e.name, e.name)); const exportClause = ts.factory.createNamedExports(exportSpecifiers); - const newEd = ts.factory.updateExportDeclaration(ed, ed.modifiers, ed.isTypeOnly, exportClause, ed.moduleSpecifier, ed.assertClause, ed.attributes); + const newEd = ts.factory.updateExportDeclaration(ed, ed.modifiers, ed.isTypeOnly, exportClause, ed.moduleSpecifier, ed.attributes); return newEd as ts.Node as T; } @@ -347,7 +347,6 @@ describe("unittests:: TransformAPI", () => { ts.factory.createNamespaceImport(ts.factory.createIdentifier("i0")), ), /*moduleSpecifier*/ ts.factory.createStringLiteral("./comp1"), - /*assertClause*/ undefined, /*attributes*/ undefined, ); return ts.factory.updateSourceFile(sf, [importStar]); diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 3a6fa355a870e..3403cc752a69e 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4408,75 +4408,75 @@ declare namespace ts { DefaultClause = 297, HeritageClause = 298, CatchClause = 299, + ImportAttributes = 300, + ImportAttribute = 301, + ImportTypeAttributes = 302, /** @deprecated */ AssertClause = 300, /** @deprecated */ AssertEntry = 301, /** @deprecated */ ImportTypeAssertionContainer = 302, - ImportAttributes = 303, - ImportAttribute = 304, - ImportTypeAttributes = 305, - PropertyAssignment = 306, - ShorthandPropertyAssignment = 307, - SpreadAssignment = 308, - EnumMember = 309, - /** @deprecated */ UnparsedPrologue = 310, - /** @deprecated */ UnparsedPrepend = 311, - /** @deprecated */ UnparsedText = 312, - /** @deprecated */ UnparsedInternalText = 313, - /** @deprecated */ UnparsedSyntheticReference = 314, - SourceFile = 315, - Bundle = 316, - /** @deprecated */ UnparsedSource = 317, - /** @deprecated */ InputFiles = 318, - JSDocTypeExpression = 319, - JSDocNameReference = 320, - JSDocMemberName = 321, - JSDocAllType = 322, - JSDocUnknownType = 323, - JSDocNullableType = 324, - JSDocNonNullableType = 325, - JSDocOptionalType = 326, - JSDocFunctionType = 327, - JSDocVariadicType = 328, - JSDocNamepathType = 329, - JSDoc = 330, + PropertyAssignment = 303, + ShorthandPropertyAssignment = 304, + SpreadAssignment = 305, + EnumMember = 306, + /** @deprecated */ UnparsedPrologue = 307, + /** @deprecated */ UnparsedPrepend = 308, + /** @deprecated */ UnparsedText = 309, + /** @deprecated */ UnparsedInternalText = 310, + /** @deprecated */ UnparsedSyntheticReference = 311, + SourceFile = 312, + Bundle = 313, + /** @deprecated */ UnparsedSource = 314, + /** @deprecated */ InputFiles = 315, + JSDocTypeExpression = 316, + JSDocNameReference = 317, + JSDocMemberName = 318, + JSDocAllType = 319, + JSDocUnknownType = 320, + JSDocNullableType = 321, + JSDocNonNullableType = 322, + JSDocOptionalType = 323, + JSDocFunctionType = 324, + JSDocVariadicType = 325, + JSDocNamepathType = 326, + JSDoc = 327, /** @deprecated Use SyntaxKind.JSDoc */ - JSDocComment = 330, - JSDocText = 331, - JSDocTypeLiteral = 332, - JSDocSignature = 333, - JSDocLink = 334, - JSDocLinkCode = 335, - JSDocLinkPlain = 336, - JSDocTag = 337, - JSDocAugmentsTag = 338, - JSDocImplementsTag = 339, - JSDocAuthorTag = 340, - JSDocDeprecatedTag = 341, - JSDocClassTag = 342, - JSDocPublicTag = 343, - JSDocPrivateTag = 344, - JSDocProtectedTag = 345, - JSDocReadonlyTag = 346, - JSDocOverrideTag = 347, - JSDocCallbackTag = 348, - JSDocOverloadTag = 349, - JSDocEnumTag = 350, - JSDocParameterTag = 351, - JSDocReturnTag = 352, - JSDocThisTag = 353, - JSDocTypeTag = 354, - JSDocTemplateTag = 355, - JSDocTypedefTag = 356, - JSDocSeeTag = 357, - JSDocPropertyTag = 358, - JSDocThrowsTag = 359, - JSDocSatisfiesTag = 360, - SyntaxList = 361, - NotEmittedStatement = 362, - PartiallyEmittedExpression = 363, - CommaListExpression = 364, - SyntheticReferenceExpression = 365, - Count = 366, + JSDocComment = 327, + JSDocText = 328, + JSDocTypeLiteral = 329, + JSDocSignature = 330, + JSDocLink = 331, + JSDocLinkCode = 332, + JSDocLinkPlain = 333, + JSDocTag = 334, + JSDocAugmentsTag = 335, + JSDocImplementsTag = 336, + JSDocAuthorTag = 337, + JSDocDeprecatedTag = 338, + JSDocClassTag = 339, + JSDocPublicTag = 340, + JSDocPrivateTag = 341, + JSDocProtectedTag = 342, + JSDocReadonlyTag = 343, + JSDocOverrideTag = 344, + JSDocCallbackTag = 345, + JSDocOverloadTag = 346, + JSDocEnumTag = 347, + JSDocParameterTag = 348, + JSDocReturnTag = 349, + JSDocThisTag = 350, + JSDocTypeTag = 351, + JSDocTemplateTag = 352, + JSDocTypedefTag = 353, + JSDocSeeTag = 354, + JSDocPropertyTag = 355, + JSDocThrowsTag = 356, + JSDocSatisfiesTag = 357, + SyntaxList = 358, + NotEmittedStatement = 359, + PartiallyEmittedExpression = 360, + CommaListExpression = 361, + SyntheticReferenceExpression = 362, + Count = 363, FirstAssignment = 64, LastAssignment = 79, FirstCompoundAssignment = 65, @@ -4504,10 +4504,10 @@ declare namespace ts { FirstStatement = 243, LastStatement = 259, FirstNode = 166, - FirstJSDocNode = 319, - LastJSDocNode = 360, - FirstJSDocTagNode = 337, - LastJSDocTagNode = 360, + FirstJSDocNode = 316, + LastJSDocNode = 357, + FirstJSDocTagNode = 334, + LastJSDocTagNode = 357, } type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; @@ -5145,15 +5145,11 @@ declare namespace ts { readonly kind: TKind; } /** @deprecated */ - interface ImportTypeAssertionContainer extends Node { - readonly kind: SyntaxKind.ImportTypeAssertionContainer; - readonly parent: ImportTypeNode; - readonly assertClause: AssertClause; - readonly multiLine?: boolean; - } + type ImportTypeAssertionContainer = ImportTypeAttributes; interface ImportTypeAttributes extends Node { readonly kind: SyntaxKind.ImportTypeAttributes; readonly parent: ImportTypeNode; + /** @deprecated */ readonly assertClause: AssertClause; readonly attributes: ImportAttributes; readonly multiLine?: boolean; } @@ -5966,22 +5962,12 @@ declare namespace ts { readonly namedBindings?: NamedImportBindings; } /** @deprecated */ - type AssertionKey = Identifier | StringLiteral; + type AssertionKey = ImportAttributeName; /** @deprecated */ - interface AssertEntry extends Node { - readonly kind: SyntaxKind.AssertEntry; - readonly parent: AssertClause; - readonly name: AssertionKey; - readonly value: Expression; - } + type AssertEntry = ImportAttribute; /** @deprecated */ - interface AssertClause extends Node { - readonly kind: SyntaxKind.AssertClause; - readonly parent: ImportDeclaration | ExportDeclaration; - readonly elements: NodeArray; - readonly multiLine?: boolean; - } - type ImportAttributeName = Identifier | StringLiteral | NumericLiteral; + type AssertClause = ImportAttributes; + type ImportAttributeName = Identifier | StringLiteral; interface ImportAttribute extends Node { readonly kind: SyntaxKind.ImportAttribute; readonly parent: ImportAttributes; @@ -5989,6 +5975,7 @@ declare namespace ts { readonly value: Expression; } interface ImportAttributes extends Node { + readonly token: SyntaxKind.WithKeyword | SyntaxKind.AssertKeyword; readonly kind: SyntaxKind.ImportAttributes; readonly parent: ImportDeclaration | ExportDeclaration; readonly elements: NodeArray; @@ -7979,8 +7966,10 @@ declare namespace ts { updateConditionalTypeNode(node: ConditionalTypeNode, checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode; createInferTypeNode(typeParameter: TypeParameterDeclaration): InferTypeNode; updateInferTypeNode(node: InferTypeNode, typeParameter: TypeParameterDeclaration): InferTypeNode; - createImportTypeNode(argument: TypeNode, assertions?: ImportTypeAssertionContainer, attributes?: ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; - updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, assertions: ImportTypeAssertionContainer | undefined, attributes: ImportTypeAttributes | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode; + /** @deprecated */ createImportTypeNode(argument: TypeNode, attributes?: ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; + createImportTypeNode(argument: TypeNode, attributes?: ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; + /** @deprecated */ updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, assertions: ImportTypeAssertionContainer | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode; + updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, attributes: ImportTypeAttributes | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode; createParenthesizedType(type: TypeNode): ParenthesizedTypeNode; updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode; createThisTypeNode(): ThisTypeNode; @@ -8137,8 +8126,8 @@ declare namespace ts { updateNamespaceExportDeclaration(node: NamespaceExportDeclaration, name: Identifier): NamespaceExportDeclaration; createImportEqualsDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; updateImportEqualsDeclaration(node: ImportEqualsDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration; - createImportDeclaration(modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause, attributes?: ImportAttributes): ImportDeclaration; - updateImportDeclaration(node: ImportDeclaration, modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined, attributes: ImportAttributes | undefined): ImportDeclaration; + createImportDeclaration(modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, attributes?: ImportAttributes): ImportDeclaration; + updateImportDeclaration(node: ImportDeclaration, modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, attributes: ImportAttributes | undefined): ImportDeclaration; createImportClause(isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause; updateImportClause(node: ImportClause, isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause; /** @deprecated */ createAssertClause(elements: NodeArray, multiLine?: boolean): AssertClause; @@ -8147,7 +8136,7 @@ declare namespace ts { /** @deprecated */ updateAssertEntry(node: AssertEntry, name: AssertionKey, value: Expression): AssertEntry; /** @deprecated */ createImportTypeAssertionContainer(clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; /** @deprecated */ updateImportTypeAssertionContainer(node: ImportTypeAssertionContainer, clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; - createImportAttributes(elements: NodeArray, multiLine?: boolean): ImportAttributes; + createImportAttributes(token: ImportAttributes["token"], elements: NodeArray, multiLine?: boolean): ImportAttributes; updateImportAttributes(node: ImportAttributes, elements: NodeArray, multiLine?: boolean): ImportAttributes; createImportAttribute(name: ImportAttributeName, value: Expression): ImportAttribute; updateImportAttribute(node: ImportAttribute, name: ImportAttributeName, value: Expression): ImportAttribute; @@ -8163,8 +8152,8 @@ declare namespace ts { updateImportSpecifier(node: ImportSpecifier, isTypeOnly: boolean, propertyName: Identifier | undefined, name: Identifier): ImportSpecifier; createExportAssignment(modifiers: readonly ModifierLike[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment; updateExportAssignment(node: ExportAssignment, modifiers: readonly ModifierLike[] | undefined, expression: Expression): ExportAssignment; - createExportDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause, attributes?: ImportAttributes): ExportDeclaration; - updateExportDeclaration(node: ExportDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined, attributes: ImportAttributes | undefined): ExportDeclaration; + createExportDeclaration(modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, attributes?: ImportAttributes): ExportDeclaration; + updateExportDeclaration(node: ExportDeclaration, modifiers: readonly ModifierLike[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, attributes: ImportAttributes | undefined): ExportDeclaration; createNamedExports(elements: readonly ExportSpecifier[]): NamedExports; updateNamedExports(node: NamedExports, elements: readonly ExportSpecifier[]): NamedExports; createExportSpecifier(isTypeOnly: boolean, propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier; @@ -8613,8 +8602,8 @@ declare namespace ts { ObjectBindingPatternElements = 525136, ArrayBindingPatternElements = 524880, ObjectLiteralExpressionProperties = 526226, - /** @deprecated */ ImportClauseEntries = 526226, ImportAttributes = 526226, + /** @deprecated */ ImportClauseEntries = 526226, ArrayLiteralExpressionElements = 8914, CommaListElements = 528, CallExpressionArguments = 2576, @@ -9043,7 +9032,6 @@ declare namespace ts { function isTypeOnlyImportDeclaration(node: Node): node is TypeOnlyImportDeclaration; function isTypeOnlyExportDeclaration(node: Node): node is TypeOnlyExportDeclaration; function isTypeOnlyImportOrExportDeclaration(node: Node): node is TypeOnlyAliasDeclaration; - function isAssertionKey(node: Node): node is AssertionKey; function isStringTextContainingNode(node: Node): node is StringLiteral | TemplateLiteralToken; function isImportAttributeName(node: Node): node is ImportAttributeName; function isModifier(node: Node): node is Modifier; diff --git a/tests/baselines/reference/importAttributes7.js b/tests/baselines/reference/importAttributes7.js index 08dce9e20bacb..66ff33e5bc507 100644 --- a/tests/baselines/reference/importAttributes7.js +++ b/tests/baselines/reference/importAttributes7.js @@ -8,11 +8,11 @@ export default { } //// [b.ts] -import a from "./a" with { a: "a", "b": "b", 1: "1" }; +import a from "./a" with { a: "a", "b": "b" }; export async function f() { const a = import("./a", { - with: { a: "a", "b": "b", 1: "1" }, + with: { a: "a", "b": "b" }, }); a; } @@ -66,7 +66,7 @@ export function f() { var a; return __generator(this, function (_a) { a = import("./a", { - with: { a: "a", "b": "b", 1: "1" }, + with: { a: "a", "b": "b" }, }); a; return [2 /*return*/]; diff --git a/tests/baselines/reference/importAttributes7.symbols b/tests/baselines/reference/importAttributes7.symbols index 31a03bf8f542f..547b876bd1b1c 100644 --- a/tests/baselines/reference/importAttributes7.symbols +++ b/tests/baselines/reference/importAttributes7.symbols @@ -13,21 +13,20 @@ export default { } === /b.ts === -import a from "./a" with { a: "a", "b": "b", 1: "1" }; +import a from "./a" with { a: "a", "b": "b" }; >a : Symbol(a, Decl(b.ts, 0, 6)) export async function f() { ->f : Symbol(f, Decl(b.ts, 0, 54)) +>f : Symbol(f, Decl(b.ts, 0, 46)) const a = import("./a", { >a : Symbol(a, Decl(b.ts, 3, 9)) >"./a" : Symbol("/a", Decl(a.ts, 0, 0)) - with: { a: "a", "b": "b", 1: "1" }, + with: { a: "a", "b": "b" }, >with : Symbol(with, Decl(b.ts, 3, 29)) >a : Symbol(a, Decl(b.ts, 4, 15)) >"b" : Symbol("b", Decl(b.ts, 4, 23)) ->1 : Symbol(1, Decl(b.ts, 4, 33)) }); a; diff --git a/tests/baselines/reference/importAttributes7.types b/tests/baselines/reference/importAttributes7.types index e76a80fc3ff6f..d4738ac844b60 100644 --- a/tests/baselines/reference/importAttributes7.types +++ b/tests/baselines/reference/importAttributes7.types @@ -18,7 +18,7 @@ export default { } === /b.ts === -import a from "./a" with { a: "a", "b": "b", 1: "1" }; +import a from "./a" with { a: "a", "b": "b" }; >a : { a: string; b: string; 1: string; } >a : error @@ -27,19 +27,17 @@ export async function f() { const a = import("./a", { >a : Promise ->import("./a", { with: { a: "a", "b": "b", 1: "1" }, }) : Promise +>import("./a", { with: { a: "a", "b": "b" }, }) : Promise >"./a" : "./a" ->{ with: { a: "a", "b": "b", 1: "1" }, } : { with: { a: string; b: string; 1: string; }; } +>{ with: { a: "a", "b": "b" }, } : { with: { a: string; b: string; }; } - with: { a: "a", "b": "b", 1: "1" }, ->with : { a: string; b: string; 1: string; } ->{ a: "a", "b": "b", 1: "1" } : { a: string; b: string; 1: string; } + with: { a: "a", "b": "b" }, +>with : { a: string; b: string; } +>{ a: "a", "b": "b" } : { a: string; b: string; } >a : string >"a" : "a" >"b" : string >"b" : "b" ->1 : string ->"1" : "1" }); a; diff --git a/tests/baselines/reference/importAttributes8.js b/tests/baselines/reference/importAttributes8.js index 581dbc1712ebf..37e87e1048cf0 100644 --- a/tests/baselines/reference/importAttributes8.js +++ b/tests/baselines/reference/importAttributes8.js @@ -4,19 +4,16 @@ export default { a: "a", b: "b", - 1: "1", } //// [b.ts] -import a from "./a" -with { a: "a", "b": "b", 1: "1" }; // ok +import a from "./a" with { a: "a", "b": "b" }; // ok //// [a.js] export default { a: "a", b: "b", - 1: "1", }; //// [b.js] export {}; diff --git a/tests/baselines/reference/importAttributes8.symbols b/tests/baselines/reference/importAttributes8.symbols index 142b656ea91a0..230d3d4bc4f6c 100644 --- a/tests/baselines/reference/importAttributes8.symbols +++ b/tests/baselines/reference/importAttributes8.symbols @@ -7,14 +7,9 @@ export default { b: "b", >b : Symbol(b, Decl(a.ts, 1, 11)) - - 1: "1", ->1 : Symbol(1, Decl(a.ts, 2, 11)) } === /b.ts === -import a from "./a" +import a from "./a" with { a: "a", "b": "b" }; // ok >a : Symbol(a, Decl(b.ts, 0, 6)) -with { a: "a", "b": "b", 1: "1" }; // ok - diff --git a/tests/baselines/reference/importAttributes8.types b/tests/baselines/reference/importAttributes8.types index 430590c957944..1dc88f33b858c 100644 --- a/tests/baselines/reference/importAttributes8.types +++ b/tests/baselines/reference/importAttributes8.types @@ -2,7 +2,7 @@ === /a.ts === export default { ->{ a: "a", b: "b", 1: "1",} : { a: string; b: string; 1: string; } +>{ a: "a", b: "b",} : { a: string; b: string; } a: "a", >a : string @@ -11,16 +11,10 @@ export default { b: "b", >b : string >"b" : "b" - - 1: "1", ->1 : string ->"1" : "1" } === /b.ts === -import a from "./a" ->a : { a: string; b: string; 1: string; } - -with { a: "a", "b": "b", 1: "1" }; // ok +import a from "./a" with { a: "a", "b": "b" }; // ok +>a : { a: string; b: string; } >a : error diff --git a/tests/baselines/reference/parseUnmatchedTypeAssertion.errors.txt b/tests/baselines/reference/parseUnmatchedTypeAssertion.errors.txt index 112a51fb92e93..ead95bd4097d8 100644 --- a/tests/baselines/reference/parseUnmatchedTypeAssertion.errors.txt +++ b/tests/baselines/reference/parseUnmatchedTypeAssertion.errors.txt @@ -1,11 +1,10 @@ parseUnmatchedTypeAssertion.ts(1,2): error TS1109: Expression expected. parseUnmatchedTypeAssertion.ts(1,12): error TS1141: String literal expected. parseUnmatchedTypeAssertion.ts(1,12): error TS2304: Cannot find name 'obju2c77'. -parseUnmatchedTypeAssertion.ts(1,21): error TS1109: Expression expected. parseUnmatchedTypeAssertion.ts(2,1): error TS1005: '{' expected. -==== parseUnmatchedTypeAssertion.ts (5 errors) ==== +==== parseUnmatchedTypeAssertion.ts (4 errors) ==== @<[[import(obju2c77, ~ !!! error TS1109: Expression expected. @@ -13,8 +12,6 @@ parseUnmatchedTypeAssertion.ts(2,1): error TS1005: '{' expected. !!! error TS1141: String literal expected. ~~~~~~~~ !!! error TS2304: Cannot find name 'obju2c77'. - -!!! error TS1109: Expression expected. !!! error TS1005: '{' expected. diff --git a/tests/cases/conformance/importAttributes/importAttributes7.ts b/tests/cases/conformance/importAttributes/importAttributes7.ts index 0b03554469e56..fe5a2950770df 100644 --- a/tests/cases/conformance/importAttributes/importAttributes7.ts +++ b/tests/cases/conformance/importAttributes/importAttributes7.ts @@ -9,11 +9,11 @@ export default { } // @filename: /b.ts -import a from "./a" with { a: "a", "b": "b", 1: "1" }; +import a from "./a" with { a: "a", "b": "b" }; export async function f() { const a = import("./a", { - with: { a: "a", "b": "b", 1: "1" }, + with: { a: "a", "b": "b" }, }); a; } diff --git a/tests/cases/conformance/importAttributes/importAttributes8.ts b/tests/cases/conformance/importAttributes/importAttributes8.ts index 93bfabd160f01..ae2b2b56a2f91 100644 --- a/tests/cases/conformance/importAttributes/importAttributes8.ts +++ b/tests/cases/conformance/importAttributes/importAttributes8.ts @@ -5,9 +5,7 @@ export default { a: "a", b: "b", - 1: "1", } // @filename: /b.ts -import a from "./a" -with { a: "a", "b": "b", 1: "1" }; // ok +import a from "./a" with { a: "a", "b": "b" }; // ok From 2569ec30a3d4ad49c09a1c7d447ea9307ec3e4f6 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Thu, 21 Sep 2023 22:12:30 +0300 Subject: [PATCH 13/21] fix formatting --- src/compiler/checker.ts | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3856b3cd99409..405c813b81410 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7918,12 +7918,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // An `import` type directed at an esm format file is only going to resolve in esm mode - set the esm mode assertion if (targetFile?.impliedNodeFormat === ModuleKind.ESNext && targetFile.impliedNodeFormat !== contextFile?.impliedNodeFormat) { specifier = getSpecifierForModuleSymbol(chain[0], context, ModuleKind.ESNext); - attributes = factory.createImportTypeAttributes(factory.createImportAttributes(SyntaxKind.WithKeyword, factory.createNodeArray([ - factory.createImportAttribute( - factory.createStringLiteral("resolution-mode"), - factory.createStringLiteral("import"), - ), - ]))); + attributes = factory.createImportTypeAttributes(factory.createImportAttributes( + SyntaxKind.WithKeyword, + factory.createNodeArray([ + factory.createImportAttribute( + factory.createStringLiteral("resolution-mode"), + factory.createStringLiteral("import"), + ), + ]), + )); } } if (!specifier) { @@ -7941,12 +7944,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { specifier = oldSpecifier; } else { - attributes = factory.createImportTypeAttributes(factory.createImportAttributes(SyntaxKind.WithKeyword, factory.createNodeArray([ - factory.createImportAttribute( - factory.createStringLiteral("resolution-mode"), - factory.createStringLiteral(swappedMode === ModuleKind.ESNext ? "import" : "require"), - ), - ]))); + attributes = factory.createImportTypeAttributes(factory.createImportAttributes( + SyntaxKind.WithKeyword, + factory.createNodeArray([ + factory.createImportAttribute( + factory.createStringLiteral("resolution-mode"), + factory.createStringLiteral(swappedMode === ModuleKind.ESNext ? "import" : "require"), + ), + ]), + )); } } @@ -39697,7 +39703,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { errorNode, node.attributes.attributes.token === SyntaxKind.WithKeyword ? Diagnostics.resolution_mode_attribute_are_only_supported_when_moduleResolution_is_node16_or_nodenext - : Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext + : Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext, ); } } From 8482633b7467bf6ed7cdb6e1fe1c9d2258da933c Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Thu, 21 Sep 2023 23:19:40 +0300 Subject: [PATCH 14/21] fix tests --- src/compiler/emitter.ts | 2 +- src/compiler/factory/nodeFactory.ts | 5 ----- src/compiler/parser.ts | 9 +++++---- src/compiler/program.ts | 5 ++--- src/compiler/types.ts | 2 -- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 9e9387a58515f..72ed50aafa8f8 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2951,7 +2951,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri writeSpace(); writePunctuation("{"); writeSpace(); - emitTokenWithComment(node.attributes.attributes.token, node.pos, writeKeyword, node); + writeKeyword(node.attributes.attributes.token === SyntaxKind.AssertKeyword ? "assert" : "with"); writePunctuation(":"); writeSpace(); const elements = node.attributes.attributes.elements; diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 0933e9f557fe7..5c36474b45218 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -2651,8 +2651,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode } // @api - function createImportTypeNode(argument: TypeNode, assertions?: ImportTypeAssertionContainer, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; - function createImportTypeNode(argument: TypeNode, attributes?: ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; function createImportTypeNode( argument: TypeNode, attributes?: ImportTypeAssertionContainer | ImportTypeAttributes, @@ -2671,8 +2669,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode } // @api - function updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, assertions: ImportTypeAssertionContainer | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean | undefined): ImportTypeNode; - function updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, attributes: ImportTypeAttributes | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean | undefined): ImportTypeNode; function updateImportTypeNode( node: ImportTypeNode, argument: TypeNode, @@ -2682,7 +2678,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode isTypeOf: boolean = node.isTypeOf, ): ImportTypeNode { return node.argument !== argument - || node.assertions !== attributes || node.attributes !== attributes || node.qualifier !== qualifier || node.typeArguments !== typeArguments diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index b2fef995c44de..eae706fa546b1 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -688,7 +688,6 @@ const forEachChildTable: ForEachChildTable = { }, [SyntaxKind.ImportType]: function forEachChildInImportType(node: ImportTypeNode, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { return visitNode(cbNode, node.argument) || - visitNode(cbNode, node.assertions) || visitNode(cbNode, node.attributes) || visitNode(cbNode, node.qualifier) || visitNodes(cbNode, cbNodes, node.typeArguments); @@ -4520,7 +4519,9 @@ namespace Parser { if (currentToken !== SyntaxKind.WithKeyword && currentToken !== SyntaxKind.AssertKeyword) { parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(SyntaxKind.WithKeyword)); } - nextToken(); + else { + nextToken(); + } parseExpected(SyntaxKind.ColonToken); const attributes = parseImportAttributes(currentToken as SyntaxKind.WithKeyword | SyntaxKind.AssertKeyword, /*shouldAdvance*/ false); if (!parseExpected(SyntaxKind.CloseBraceToken)) { @@ -8363,7 +8364,7 @@ namespace Parser { const moduleSpecifier = parseModuleSpecifier(); const currentToken = token(); let attributes: ImportAttributes | undefined; - if (currentToken === SyntaxKind.WithKeyword || currentToken === SyntaxKind.AssertKeyword) { + if ((currentToken === SyntaxKind.WithKeyword || currentToken === SyntaxKind.AssertKeyword) && !scanner.hasPrecedingLineBreak()) { attributes = parseImportAttributes(currentToken); } parseSemicolon(); @@ -8625,7 +8626,7 @@ namespace Parser { } } const currentToken = token(); - if (moduleSpecifier && (currentToken === SyntaxKind.WithKeyword || currentToken === SyntaxKind.AssertKeyword)) { + if (moduleSpecifier && (currentToken === SyntaxKind.WithKeyword || currentToken === SyntaxKind.AssertKeyword) && !scanner.hasPrecedingLineBreak()) { attributes = parseImportAttributes(currentToken); } parseSemicolon(); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 0d86402d08f42..0f359a893d9bc 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -190,7 +190,6 @@ import { isExternalModule, isExternalModuleNameRelative, isIdentifierText, - isImportAttributes, isImportCall, isImportDeclaration, isImportEqualsDeclaration, @@ -930,7 +929,7 @@ export function getResolutionModeOverride(node: AssertClause | ImportAttributes if (length(node.elements) !== 1) { grammarErrorOnNode?.( node, - isImportAttributes(node) + node.token === SyntaxKind.WithKeyword ? Diagnostics.Type_import_attributes_should_have_exactly_one_key_resolution_mode_with_value_import_or_require : Diagnostics.Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require, ); @@ -941,7 +940,7 @@ export function getResolutionModeOverride(node: AssertClause | ImportAttributes if (elem.name.text !== "resolution-mode") { grammarErrorOnNode?.( elem.name, - isImportAttributes(node) + node.token === SyntaxKind.WithKeyword ? Diagnostics.resolution_mode_is_the_only_valid_key_for_type_import_attributes : Diagnostics.resolution_mode_is_the_only_valid_key_for_type_import_assertions, ); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 8ee858d031b43..27af2891d583f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -8425,9 +8425,7 @@ export interface NodeFactory { updateConditionalTypeNode(node: ConditionalTypeNode, checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode; createInferTypeNode(typeParameter: TypeParameterDeclaration): InferTypeNode; updateInferTypeNode(node: InferTypeNode, typeParameter: TypeParameterDeclaration): InferTypeNode; - /** @deprecated */ createImportTypeNode(argument: TypeNode, attributes?: ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; createImportTypeNode(argument: TypeNode, attributes?: ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; - /** @deprecated */ updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, assertions: ImportTypeAssertionContainer | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode; updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, attributes: ImportTypeAttributes | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode; createParenthesizedType(type: TypeNode): ParenthesizedTypeNode; updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode; From ba1f979d9f20c0231c35448f97cd0d8dc3371b08 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Fri, 22 Sep 2023 00:22:46 +0300 Subject: [PATCH 15/21] baseline update --- tests/baselines/reference/api/typescript.d.ts | 2 - .../parseImportAttributesError.errors.txt | 114 +++++++++++++++--- .../reference/parseImportAttributesError.js | 16 ++- .../parseImportAttributesError.symbols | 11 +- .../parseImportAttributesError.types | 43 +++++-- .../parseUnmatchedTypeAssertion.errors.txt | 5 +- 6 files changed, 161 insertions(+), 30 deletions(-) diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 3403cc752a69e..62aedc2267242 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -7966,9 +7966,7 @@ declare namespace ts { updateConditionalTypeNode(node: ConditionalTypeNode, checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode; createInferTypeNode(typeParameter: TypeParameterDeclaration): InferTypeNode; updateInferTypeNode(node: InferTypeNode, typeParameter: TypeParameterDeclaration): InferTypeNode; - /** @deprecated */ createImportTypeNode(argument: TypeNode, attributes?: ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; createImportTypeNode(argument: TypeNode, attributes?: ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; - /** @deprecated */ updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, assertions: ImportTypeAssertionContainer | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode; updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, attributes: ImportTypeAttributes | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode; createParenthesizedType(type: TypeNode): ParenthesizedTypeNode; updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode; diff --git a/tests/baselines/reference/parseImportAttributesError.errors.txt b/tests/baselines/reference/parseImportAttributesError.errors.txt index 97893dec8d6b5..55a242afe77e4 100644 --- a/tests/baselines/reference/parseImportAttributesError.errors.txt +++ b/tests/baselines/reference/parseImportAttributesError.errors.txt @@ -1,30 +1,116 @@ -/index.ts(2,34): error TS1005: ':' expected. +error TS2468: Cannot find global value 'Promise'. +/index.ts(2,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/index.ts(2,30): error TS1478: Identifier or string literal expected. +/index.ts(2,30): error TS2695: Left side of comma operator is unused and has no side effects. +/index.ts(2,53): error TS1005: ';' expected. +/index.ts(2,64): error TS1128: Declaration or statement expected. +/index.ts(2,66): error TS1128: Declaration or statement expected. +/index.ts(2,67): error TS1128: Declaration or statement expected. +/index.ts(2,68): error TS1128: Declaration or statement expected. +/index.ts(2,69): error TS2304: Cannot find name 'RequireInterface'. +/index.ts(3,7): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /index.ts(3,34): error TS1005: ':' expected. -/index.ts(3,68): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/index.ts(5,61): error TS1005: ':' expected. -/index.ts(6,61): error TS1005: ':' expected. -/index.ts(6,95): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +/index.ts(3,68): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. +/index.ts(5,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/index.ts(5,57): error TS1478: Identifier or string literal expected. +/index.ts(5,57): error TS2695: Left side of comma operator is unused and has no side effects. +/index.ts(5,80): error TS1005: ';' expected. +/index.ts(5,91): error TS1128: Declaration or statement expected. +/index.ts(5,93): error TS1128: Declaration or statement expected. +/index.ts(5,94): error TS1128: Declaration or statement expected. +/index.ts(5,95): error TS1128: Declaration or statement expected. +/index.ts(5,96): error TS1434: Unexpected keyword or identifier. +/index.ts(5,96): error TS2304: Cannot find name 'RequireInterface'. +/index.ts(5,112): error TS1128: Declaration or statement expected. +/index.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/index.ts(6,57): error TS1478: Identifier or string literal expected. +/index.ts(6,57): error TS2695: Left side of comma operator is unused and has no side effects. +/index.ts(6,80): error TS1005: ';' expected. +/index.ts(6,90): error TS1128: Declaration or statement expected. +/index.ts(6,92): error TS1128: Declaration or statement expected. +/index.ts(6,93): error TS1128: Declaration or statement expected. +/index.ts(6,94): error TS1128: Declaration or statement expected. +/index.ts(6,95): error TS1434: Unexpected keyword or identifier. +/index.ts(6,95): error TS2304: Cannot find name 'ImportInterface'. +/index.ts(6,110): error TS1128: Declaration or statement expected. -==== /index.ts (6 errors) ==== +!!! error TS2468: Cannot find global value 'Promise'. +==== /index.ts (34 errors) ==== export type LocalInterface = & import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface - ~ -!!! error TS1005: ':' expected. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~ +!!! error TS1478: Identifier or string literal expected. + ~~~~ +!!! error TS2695: Left side of comma operator is unused and has no side effects. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~ !!! error TS1005: ':' expected. ~~~~~~~~~~~~~~~ -!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +!!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. export const a = (null as any as import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface); - ~ -!!! error TS1005: ':' expected. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~ +!!! error TS1478: Identifier or string literal expected. + ~~~~ +!!! error TS2695: Left side of comma operator is unused and has no side effects. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + ~ +!!! error TS1128: Declaration or statement expected. export const b = (null as any as import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface); - ~ -!!! error TS1005: ':' expected. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~ +!!! error TS1478: Identifier or string literal expected. + ~~~~ +!!! error TS2695: Left side of comma operator is unused and has no side effects. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~~~~~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. ~~~~~~~~~~~~~~~ -!!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +!!! error TS2304: Cannot find name 'ImportInterface'. + ~ +!!! error TS1128: Declaration or statement expected. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/parseImportAttributesError.js b/tests/baselines/reference/parseImportAttributesError.js index e0596a83f2d66..d2de9a505d022 100644 --- a/tests/baselines/reference/parseImportAttributesError.js +++ b/tests/baselines/reference/parseImportAttributesError.js @@ -29,11 +29,23 @@ export const b = (null as any as import("pkg", { with: {1234, "resolution-mode": "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.b = exports.a = void 0; +1234, "resolution-mode"; +"require"; +RequireInterface + & import("pkg", { with: { 1234: , "resolution-mode": "import" } }).ImportInterface; exports.a = null; +1234, "resolution-mode"; +"require"; +RequireInterface; +; exports.b = null; +1234, "resolution-mode"; +"import"; +ImportInterface; +; //// [index.d.ts] -export type LocalInterface = import("pkg", { with: { 1234: , "resolution-mode": "require" } }).RequireInterface & import("pkg", { with: { 1234: , "resolution-mode": "import" } }).ImportInterface; -export declare const a: import("pkg").RequireInterface; +export type LocalInterface = import("pkg", { with: {} }); +export declare const a: any; export declare const b: any; diff --git a/tests/baselines/reference/parseImportAttributesError.symbols b/tests/baselines/reference/parseImportAttributesError.symbols index c2510c4f88f69..c5717d367b5c2 100644 --- a/tests/baselines/reference/parseImportAttributesError.symbols +++ b/tests/baselines/reference/parseImportAttributesError.symbols @@ -5,17 +5,22 @@ export type LocalInterface = >LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) & import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface ->RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) - & import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface; +>"pkg" : Symbol("/node_modules/pkg/import", Decl(import.d.ts, 0, 0)) +>with : Symbol(with, Decl(index.ts, 2, 21)) +>1234 : Symbol(1234, Decl(index.ts, 2, 29)) +>"resolution-mode" : Symbol("resolution-mode", Decl(index.ts, 2, 34)) export const a = (null as any as import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface); >a : Symbol(a, Decl(index.ts, 4, 12)) ->RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) export const b = (null as any as import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface); >b : Symbol(b, Decl(index.ts, 5, 12)) +=== /node_modules/pkg/import.d.ts === +export interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) + === /node_modules/pkg/require.d.ts === export interface RequireInterface {} >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) diff --git a/tests/baselines/reference/parseImportAttributesError.types b/tests/baselines/reference/parseImportAttributesError.types index 3c34791903cb1..60ba390c491ee 100644 --- a/tests/baselines/reference/parseImportAttributesError.types +++ b/tests/baselines/reference/parseImportAttributesError.types @@ -5,24 +5,51 @@ export type LocalInterface = >LocalInterface : any & import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface -> : any +>1234, "resolution-mode" : "resolution-mode" +>1234 : 1234 +>"resolution-mode" : "resolution-mode" +>"require" : "require" +>RequireInterface & import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface : number +>RequireInterface : any & import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface; +>import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface : any +>import("pkg", { with: {1234, "resolution-mode": "import"} }) : Promise<{ default: typeof import("/node_modules/pkg/import"); }> +>"pkg" : "pkg" +>{ with: {1234, "resolution-mode": "import"} } : { with: { 1234: any; "resolution-mode": string; }; } +>with : { 1234: any; "resolution-mode": string; } +>{1234, "resolution-mode": "import"} : { 1234: any; "resolution-mode": string; } +>1234 : any > : any +>"resolution-mode" : string +>"import" : "import" +>ImportInterface : any export const a = (null as any as import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface); ->a : import("/node_modules/pkg/require").RequireInterface ->(null as any as import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface) : import("/node_modules/pkg/require").RequireInterface ->null as any as import("pkg", { with: {1234, "resolution-mode": "require"} }).RequireInterface : import("/node_modules/pkg/require").RequireInterface +>a : any +>(null as any as import("pkg", { with: { : any +>null as any as import("pkg", { with: { : any >null as any : any -> : any +>1234, "resolution-mode" : "resolution-mode" +>1234 : 1234 +>"resolution-mode" : "resolution-mode" +>"require" : "require" +>RequireInterface : any export const b = (null as any as import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface); >b : any ->(null as any as import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface) : any ->null as any as import("pkg", { with: {1234, "resolution-mode": "import"} }).ImportInterface : any +>(null as any as import("pkg", { with: { : any +>null as any as import("pkg", { with: { : any >null as any : any -> : any +>1234, "resolution-mode" : "resolution-mode" +>1234 : 1234 +>"resolution-mode" : "resolution-mode" +>"import" : "import" +>ImportInterface : any + +=== /node_modules/pkg/import.d.ts === + +export interface ImportInterface {} === /node_modules/pkg/require.d.ts === diff --git a/tests/baselines/reference/parseUnmatchedTypeAssertion.errors.txt b/tests/baselines/reference/parseUnmatchedTypeAssertion.errors.txt index ead95bd4097d8..112a51fb92e93 100644 --- a/tests/baselines/reference/parseUnmatchedTypeAssertion.errors.txt +++ b/tests/baselines/reference/parseUnmatchedTypeAssertion.errors.txt @@ -1,10 +1,11 @@ parseUnmatchedTypeAssertion.ts(1,2): error TS1109: Expression expected. parseUnmatchedTypeAssertion.ts(1,12): error TS1141: String literal expected. parseUnmatchedTypeAssertion.ts(1,12): error TS2304: Cannot find name 'obju2c77'. +parseUnmatchedTypeAssertion.ts(1,21): error TS1109: Expression expected. parseUnmatchedTypeAssertion.ts(2,1): error TS1005: '{' expected. -==== parseUnmatchedTypeAssertion.ts (4 errors) ==== +==== parseUnmatchedTypeAssertion.ts (5 errors) ==== @<[[import(obju2c77, ~ !!! error TS1109: Expression expected. @@ -12,6 +13,8 @@ parseUnmatchedTypeAssertion.ts(2,1): error TS1005: '{' expected. !!! error TS1141: String literal expected. ~~~~~~~~ !!! error TS2304: Cannot find name 'obju2c77'. + +!!! error TS1109: Expression expected. !!! error TS1005: '{' expected. From 11d556a1f609d45a4eff8b69a65e9591c795bde9 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Fri, 22 Sep 2023 01:05:14 +0300 Subject: [PATCH 16/21] remove token param from public API --- src/compiler/checker.ts | 2 -- src/compiler/factory/nodeFactory.ts | 8 +++++--- src/compiler/parser.ts | 4 ++-- src/compiler/types.ts | 3 ++- tests/baselines/reference/api/typescript.d.ts | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 405c813b81410..d3da9c702e2d5 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7919,7 +7919,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (targetFile?.impliedNodeFormat === ModuleKind.ESNext && targetFile.impliedNodeFormat !== contextFile?.impliedNodeFormat) { specifier = getSpecifierForModuleSymbol(chain[0], context, ModuleKind.ESNext); attributes = factory.createImportTypeAttributes(factory.createImportAttributes( - SyntaxKind.WithKeyword, factory.createNodeArray([ factory.createImportAttribute( factory.createStringLiteral("resolution-mode"), @@ -7945,7 +7944,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } else { attributes = factory.createImportTypeAttributes(factory.createImportAttributes( - SyntaxKind.WithKeyword, factory.createNodeArray([ factory.createImportAttribute( factory.createStringLiteral("resolution-mode"), diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 5c36474b45218..b460e21246fb7 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -4829,9 +4829,11 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode } // @api - function createImportAttributes(token: ImportAttributes["token"], elements: readonly ImportAttribute[], multiLine?: boolean): ImportAttributes { + function createImportAttributes(elements: readonly ImportAttribute[], multiLine?: boolean): ImportAttributes; + function createImportAttributes(elements: readonly ImportAttribute[], multiLine?: boolean, token?: ImportAttributes["token"]): ImportAttributes; + function createImportAttributes(elements: readonly ImportAttribute[], multiLine?: boolean, token?: ImportAttributes["token"]): ImportAttributes { const node = createBaseNode(SyntaxKind.ImportAttributes); - node.token = token; + node.token = token ?? SyntaxKind.WithKeyword; node.elements = createNodeArray(elements); node.multiLine = multiLine; node.transformFlags |= TransformFlags.ContainsESNext; @@ -4842,7 +4844,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function updateImportAttributes(node: ImportAttributes, elements: readonly ImportAttribute[], multiLine?: boolean): ImportAttributes { return node.elements !== elements || node.multiLine !== multiLine - ? update(createImportAttributes(node.token, elements, multiLine), node) + ? update(createImportAttributes(elements, multiLine, node.token), node) : node; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index eae706fa546b1..09c0a42591f26 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -8398,11 +8398,11 @@ namespace Parser { ); } } - return finishNode(factory.createImportAttributes(token, elements, multiLine), pos); + return finishNode(factory.createImportAttributes(elements, multiLine, token), pos); } else { const elements = createNodeArray([], getNodePos(), /*end*/ undefined, /*hasTrailingComma*/ false); - return finishNode(factory.createImportAttributes(token, elements, /*multiLine*/ false), pos); + return finishNode(factory.createImportAttributes(elements, /*multiLine*/ false, token), pos); } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 27af2891d583f..aa6de769dbeea 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -8616,7 +8616,8 @@ export interface NodeFactory { /** @deprecated */ updateAssertEntry(node: AssertEntry, name: AssertionKey, value: Expression): AssertEntry; /** @deprecated */ createImportTypeAssertionContainer(clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; /** @deprecated */ updateImportTypeAssertionContainer(node: ImportTypeAssertionContainer, clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; - createImportAttributes(token: ImportAttributes["token"], elements: NodeArray, multiLine?: boolean): ImportAttributes; + createImportAttributes(elements: NodeArray, multiLine?: boolean): ImportAttributes; + /** @internal */ createImportAttributes(elements: NodeArray, multiLine?: boolean, token?: ImportAttributes["token"]): ImportAttributes; updateImportAttributes(node: ImportAttributes, elements: NodeArray, multiLine?: boolean): ImportAttributes; createImportAttribute(name: ImportAttributeName, value: Expression): ImportAttribute; updateImportAttribute(node: ImportAttribute, name: ImportAttributeName, value: Expression): ImportAttribute; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 62aedc2267242..06039459569d1 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -8134,7 +8134,7 @@ declare namespace ts { /** @deprecated */ updateAssertEntry(node: AssertEntry, name: AssertionKey, value: Expression): AssertEntry; /** @deprecated */ createImportTypeAssertionContainer(clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; /** @deprecated */ updateImportTypeAssertionContainer(node: ImportTypeAssertionContainer, clause: AssertClause, multiLine?: boolean): ImportTypeAssertionContainer; - createImportAttributes(token: ImportAttributes["token"], elements: NodeArray, multiLine?: boolean): ImportAttributes; + createImportAttributes(elements: NodeArray, multiLine?: boolean): ImportAttributes; updateImportAttributes(node: ImportAttributes, elements: NodeArray, multiLine?: boolean): ImportAttributes; createImportAttribute(name: ImportAttributeName, value: Expression): ImportAttribute; updateImportAttribute(node: ImportAttribute, name: ImportAttributeName, value: Expression): ImportAttribute; From e0afc4a963b376a94734d222da03d28fc905bd12 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Fri, 22 Sep 2023 01:09:56 +0300 Subject: [PATCH 17/21] fix factory api signatures --- src/compiler/factory/nodeFactory.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index b460e21246fb7..b7b47468a235c 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -2653,7 +2653,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function createImportTypeNode( argument: TypeNode, - attributes?: ImportTypeAssertionContainer | ImportTypeAttributes, + attributes?: ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf = false, @@ -2672,7 +2672,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function updateImportTypeNode( node: ImportTypeNode, argument: TypeNode, - attributes: ImportTypeAssertionContainer | ImportTypeAttributes | undefined, + attributes: ImportTypeAttributes | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf: boolean = node.isTypeOf, @@ -4706,7 +4706,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, - attributes: ImportAttributes | AssertClause | undefined, + attributes: ImportAttributes | undefined, ): ImportDeclaration { const node = createBaseNode(SyntaxKind.ImportDeclaration); node.modifiers = asNodeArray(modifiers); @@ -4727,7 +4727,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode modifiers: readonly ModifierLike[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, - attributes: ImportAttributes | AssertClause | undefined, + attributes: ImportAttributes | undefined, ) { return node.modifiers !== modifiers || node.importClause !== importClause @@ -4972,7 +4972,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, - attributes?: AssertClause | ImportAttributes, + attributes?: ImportAttributes, ) { const node = createBaseDeclaration(SyntaxKind.ExportDeclaration); node.modifiers = asNodeArray(modifiers); @@ -4996,7 +4996,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, - attributes: AssertClause | ImportAttributes | undefined, + attributes: ImportAttributes | undefined, ) { return node.modifiers !== modifiers || node.isTypeOnly !== isTypeOnly From 3d3939a45a240bba84b6091b04d0cc963f955f58 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Fri, 22 Sep 2023 22:09:50 +0300 Subject: [PATCH 18/21] update diagnostic messages --- src/compiler/checker.ts | 4 +-- src/compiler/diagnosticMessages.json | 8 ++--- ...rationEmitErrors(module=node16).errors.txt | 32 +++++++++---------- ...tionEmitErrors(module=nodenext).errors.txt | 32 +++++++++---------- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d3da9c702e2d5..c748b30f4a54d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -39700,7 +39700,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { grammarErrorOnNode( errorNode, node.attributes.attributes.token === SyntaxKind.WithKeyword - ? Diagnostics.resolution_mode_attribute_are_only_supported_when_moduleResolution_is_node16_or_nodenext + ? Diagnostics.The_resolution_mode_attribute_is_only_supported_when_moduleResolution_is_node16_or_nodenext : Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext, ); } @@ -45147,7 +45147,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return grammarErrorOnNode( node, isImportAttributes - ? Diagnostics.resolution_mode_attribute_are_only_supported_when_moduleResolution_is_node16_or_nodenext + ? Diagnostics.The_resolution_mode_attribute_is_only_supported_when_moduleResolution_is_node16_or_nodenext : Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext, ); } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index d5daa8a88a17a..98dee5f2e4fff 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1524,15 +1524,15 @@ "category": "Message", "code": 1461 }, - "'resolution-mode' attribute are only supported when `moduleResolution` is `node16` or `nodenext`.": { + "The 'resolution-mode' attribute is only supported when 'moduleResolution' is 'node16' or 'nodenext'.": { "category": "Error", "code": 1462 }, - "`resolution-mode` is the only valid key for type import attributes.": { + "'resolution-mode' is the only valid key for type import attributes.": { "category": "Error", "code": 1463 }, - "Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`.": { + "Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'.": { "category": "Error", "code": 1464 }, @@ -1641,7 +1641,7 @@ "category": "Error", "code": 1495 }, - "Identifier, string literal or number literal expected.": { + "Identifier, string literal, or number literal expected.": { "category": "Error", "code": 1496 }, diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt index b6de1111e72aa..340ef90ef8368 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node16).errors.txt @@ -29,11 +29,11 @@ error TS2468: Cannot find global value 'Promise'. /other.ts(7,79): error TS1434: Unexpected keyword or identifier. /other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. /other.ts(7,94): error TS1128: Declaration or statement expected. -/other2.ts(3,30): error TS1463: `resolution-mode` is the only valid key for type import attributes. -/other2.ts(4,30): error TS1463: `resolution-mode` is the only valid key for type import attributes. +/other2.ts(3,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. +/other2.ts(4,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. /other2.ts(4,50): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other2.ts(6,57): error TS1463: `resolution-mode` is the only valid key for type import attributes. -/other2.ts(7,57): error TS1463: `resolution-mode` is the only valid key for type import attributes. +/other2.ts(6,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. +/other2.ts(7,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. /other2.ts(7,77): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. /other3.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other3.ts(3,21): error TS1005: '{' expected. @@ -71,11 +71,11 @@ error TS2468: Cannot find global value 'Promise'. /other4.ts(10,58): error TS1005: ',' expected. /other4.ts(10,59): error TS1134: Variable declaration expected. /other4.ts(10,75): error TS1005: ',' expected. -/other5.ts(2,29): error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. -/other5.ts(3,29): error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(2,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. +/other5.ts(3,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /other5.ts(3,35): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other5.ts(5,56): error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. -/other5.ts(6,56): error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(5,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. +/other5.ts(6,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /other5.ts(6,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -180,19 +180,19 @@ error TS2468: Cannot find global value 'Promise'. export type LocalInterface = & import("pkg", { with: {"bad": "require"} }).RequireInterface ~~~~~ -!!! error TS1463: `resolution-mode` is the only valid key for type import attributes. +!!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. & import("pkg", { with: {"bad": "import"} }).ImportInterface; ~~~~~ -!!! error TS1463: `resolution-mode` is the only valid key for type import attributes. +!!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); ~~~~~ -!!! error TS1463: `resolution-mode` is the only valid key for type import attributes. +!!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); ~~~~~ -!!! error TS1463: `resolution-mode` is the only valid key for type import attributes. +!!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -302,18 +302,18 @@ error TS2468: Cannot find global value 'Promise'. export type LocalInterface = & import("pkg", { with: {} }).RequireInterface ~~ -!!! error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +!!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. & import("pkg", { with: {} }).ImportInterface; ~~ -!!! error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +!!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { with: {} }).RequireInterface); ~~ -!!! error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +!!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. export const b = (null as any as import("pkg", { with: {} }).ImportInterface); ~~ -!!! error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +!!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt index b6de1111e72aa..340ef90ef8368 100644 --- a/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=nodenext).errors.txt @@ -29,11 +29,11 @@ error TS2468: Cannot find global value 'Promise'. /other.ts(7,79): error TS1434: Unexpected keyword or identifier. /other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. /other.ts(7,94): error TS1128: Declaration or statement expected. -/other2.ts(3,30): error TS1463: `resolution-mode` is the only valid key for type import attributes. -/other2.ts(4,30): error TS1463: `resolution-mode` is the only valid key for type import attributes. +/other2.ts(3,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. +/other2.ts(4,30): error TS1463: 'resolution-mode' is the only valid key for type import attributes. /other2.ts(4,50): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other2.ts(6,57): error TS1463: `resolution-mode` is the only valid key for type import attributes. -/other2.ts(7,57): error TS1463: `resolution-mode` is the only valid key for type import attributes. +/other2.ts(6,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. +/other2.ts(7,57): error TS1463: 'resolution-mode' is the only valid key for type import attributes. /other2.ts(7,77): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. /other3.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other3.ts(3,21): error TS1005: '{' expected. @@ -71,11 +71,11 @@ error TS2468: Cannot find global value 'Promise'. /other4.ts(10,58): error TS1005: ',' expected. /other4.ts(10,59): error TS1134: Variable declaration expected. /other4.ts(10,75): error TS1005: ',' expected. -/other5.ts(2,29): error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. -/other5.ts(3,29): error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(2,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. +/other5.ts(3,29): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /other5.ts(3,35): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other5.ts(5,56): error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. -/other5.ts(6,56): error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(5,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. +/other5.ts(6,56): error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. /other5.ts(6,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -180,19 +180,19 @@ error TS2468: Cannot find global value 'Promise'. export type LocalInterface = & import("pkg", { with: {"bad": "require"} }).RequireInterface ~~~~~ -!!! error TS1463: `resolution-mode` is the only valid key for type import attributes. +!!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. & import("pkg", { with: {"bad": "import"} }).ImportInterface; ~~~~~ -!!! error TS1463: `resolution-mode` is the only valid key for type import attributes. +!!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { with: {"bad": "require"} }).RequireInterface); ~~~~~ -!!! error TS1463: `resolution-mode` is the only valid key for type import attributes. +!!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. export const b = (null as any as import("pkg", { with: {"bad": "import"} }).ImportInterface); ~~~~~ -!!! error TS1463: `resolution-mode` is the only valid key for type import attributes. +!!! error TS1463: 'resolution-mode' is the only valid key for type import attributes. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -302,18 +302,18 @@ error TS2468: Cannot find global value 'Promise'. export type LocalInterface = & import("pkg", { with: {} }).RequireInterface ~~ -!!! error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +!!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. & import("pkg", { with: {} }).ImportInterface; ~~ -!!! error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +!!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { with: {} }).RequireInterface); ~~ -!!! error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +!!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. export const b = (null as any as import("pkg", { with: {} }).ImportInterface); ~~ -!!! error TS1464: Type import attributes should have exactly one key - `resolution-mode` - with value `import` or `require`. +!!! error TS1464: Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. \ No newline at end of file From bf3634382e9556dccd6187ee4a14ab18bad90d4d Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Fri, 22 Sep 2023 23:41:16 +0300 Subject: [PATCH 19/21] rid of ImportTypeAttributes interface --- src/compiler/checker.ts | 18 +++--- src/compiler/emitter.ts | 6 +- src/compiler/factory/nodeFactory.ts | 28 ++------- src/compiler/factory/nodeTests.ts | 5 -- src/compiler/parser.ts | 61 ++++++++----------- src/compiler/program.ts | 2 +- src/compiler/types.ts | 19 ++---- src/compiler/utilities.ts | 2 +- src/compiler/visitorPublic.ts | 10 +-- tests/baselines/reference/api/typescript.d.ts | 16 ++--- 10 files changed, 63 insertions(+), 104 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c748b30f4a54d..53f4fe506c08e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -405,6 +405,7 @@ import { IdentifierTypePredicate, idText, IfStatement, + ImportAttributes, ImportCall, ImportClause, ImportDeclaration, @@ -412,7 +413,6 @@ import { ImportOrExportSpecifier, ImportsNotUsedAsValues, ImportSpecifier, - ImportTypeAttributes, ImportTypeNode, IndexedAccessType, IndexedAccessTypeNode, @@ -7913,19 +7913,19 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const contextFile = getSourceFileOfNode(getOriginalNode(context.enclosingDeclaration)); const targetFile = getSourceFileOfModule(chain[0]); let specifier: string | undefined; - let attributes: ImportTypeAttributes | undefined; + let attributes: ImportAttributes | undefined; if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Node16 || getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeNext) { // An `import` type directed at an esm format file is only going to resolve in esm mode - set the esm mode assertion if (targetFile?.impliedNodeFormat === ModuleKind.ESNext && targetFile.impliedNodeFormat !== contextFile?.impliedNodeFormat) { specifier = getSpecifierForModuleSymbol(chain[0], context, ModuleKind.ESNext); - attributes = factory.createImportTypeAttributes(factory.createImportAttributes( + attributes = factory.createImportAttributes( factory.createNodeArray([ factory.createImportAttribute( factory.createStringLiteral("resolution-mode"), factory.createStringLiteral("import"), ), ]), - )); + ); } } if (!specifier) { @@ -7943,14 +7943,14 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { specifier = oldSpecifier; } else { - attributes = factory.createImportTypeAttributes(factory.createImportAttributes( + attributes = factory.createImportAttributes( factory.createNodeArray([ factory.createImportAttribute( factory.createStringLiteral("resolution-mode"), factory.createStringLiteral(swappedMode === ModuleKind.ESNext ? "import" : "require"), ), ]), - )); + ); } } @@ -39694,12 +39694,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { checkSourceElement(node.argument); if (node.attributes) { - const override = getResolutionModeOverride(node.attributes?.attributes, grammarErrorOnNode); - const errorNode = node.attributes?.attributes; + const override = getResolutionModeOverride(node.attributes, grammarErrorOnNode); + const errorNode = node.attributes; if (override && errorNode && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Node16 && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.NodeNext) { grammarErrorOnNode( errorNode, - node.attributes.attributes.token === SyntaxKind.WithKeyword + node.attributes.token === SyntaxKind.WithKeyword ? Diagnostics.The_resolution_mode_attribute_is_only_supported_when_moduleResolution_is_node16_or_nodenext : Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext, ); diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 72ed50aafa8f8..5d9222b835033 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2951,11 +2951,11 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri writeSpace(); writePunctuation("{"); writeSpace(); - writeKeyword(node.attributes.attributes.token === SyntaxKind.AssertKeyword ? "assert" : "with"); + writeKeyword(node.attributes.token === SyntaxKind.AssertKeyword ? "assert" : "with"); writePunctuation(":"); writeSpace(); - const elements = node.attributes.attributes.elements; - emitList(node.attributes.attributes, elements, ListFormat.ImportAttributes); + const elements = node.attributes.elements; + emitList(node.attributes, elements, ListFormat.ImportAttributes); writeSpace(); writePunctuation("}"); } diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index b7b47468a235c..4d3733b165043 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -145,7 +145,6 @@ import { ImportEqualsDeclaration, ImportSpecifier, ImportTypeAssertionContainer, - ImportTypeAttributes, ImportTypeNode, IndexedAccessTypeNode, IndexSignatureDeclaration, @@ -795,8 +794,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode updateAssertEntry, createImportTypeAssertionContainer, updateImportTypeAssertionContainer, - createImportTypeAttributes, - updateImportTypeAttributes, createImportAttributes, updateImportAttributes, createImportAttribute, @@ -2653,14 +2650,17 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // @api function createImportTypeNode( argument: TypeNode, - attributes?: ImportTypeAttributes, + attributes?: ImportAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf = false, ): ImportTypeNode { const node = createBaseNode(SyntaxKind.ImportType); node.argument = argument; - node.attributes = node.assertions = attributes; + node.attributes = attributes; + if (node.assertions && node.assertions.assertClause && node.attributes) { + (node.assertions as Mutable).assertClause = node.attributes; + } node.qualifier = qualifier; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.isTypeOf = isTypeOf; @@ -2672,7 +2672,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function updateImportTypeNode( node: ImportTypeNode, argument: TypeNode, - attributes: ImportTypeAttributes | undefined, + attributes: ImportAttributes | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf: boolean = node.isTypeOf, @@ -4812,22 +4812,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode : node; } - // @api - function createImportTypeAttributes(attributes: ImportAttributes, multiLine?: boolean): ImportTypeAttributes { - const node = createBaseNode(SyntaxKind.ImportTypeAttributes); - node.attributes = node.assertClause = attributes; - node.multiLine = multiLine; - return node; - } - - // @api - function updateImportTypeAttributes(node: ImportTypeAttributes, attributes: ImportAttributes, multiLine?: boolean): ImportTypeAttributes { - return node.attributes !== attributes - || node.multiLine !== multiLine - ? update(createImportTypeAttributes(attributes, multiLine), node) - : node; - } - // @api function createImportAttributes(elements: readonly ImportAttribute[], multiLine?: boolean): ImportAttributes; function createImportAttributes(elements: readonly ImportAttribute[], multiLine?: boolean, token?: ImportAttributes["token"]): ImportAttributes; diff --git a/src/compiler/factory/nodeTests.ts b/src/compiler/factory/nodeTests.ts index fb9a305c4b364..eca54d346d882 100644 --- a/src/compiler/factory/nodeTests.ts +++ b/src/compiler/factory/nodeTests.ts @@ -75,7 +75,6 @@ import { ImportExpression, ImportSpecifier, ImportTypeAssertionContainer, - ImportTypeAttributes, ImportTypeNode, IndexedAccessTypeNode, IndexSignatureDeclaration, @@ -850,10 +849,6 @@ export function isImportTypeAssertionContainer(node: Node): node is ImportTypeAs return node.kind === SyntaxKind.ImportTypeAssertionContainer; } -export function isImportTypeAttributes(node: Node): node is ImportTypeAttributes { - return node.kind === SyntaxKind.ImportTypeAttributes; -} - /** @deprecated */ export function isAssertClause(node: Node): node is AssertClause { return node.kind === SyntaxKind.AssertClause; diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 09c0a42591f26..f9a9fe9fa3b43 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -122,7 +122,7 @@ import { ImportEqualsDeclaration, ImportOrExportSpecifier, ImportSpecifier, - ImportTypeAttributes, + ImportTypeAssertionContainer, ImportTypeNode, IndexedAccessTypeNode, IndexSignatureDeclaration, @@ -692,8 +692,8 @@ const forEachChildTable: ForEachChildTable = { visitNode(cbNode, node.qualifier) || visitNodes(cbNode, cbNodes, node.typeArguments); }, - [SyntaxKind.ImportTypeAttributes]: function forEachChildInImportTypeAttributes(node: ImportTypeAttributes, cbNode: (node: Node) => T | undefined, _cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { - return visitNode(cbNode, node.attributes); + [SyntaxKind.ImportTypeAssertionContainer]: function forEachChildInImportTypeAssertionContainer(node: ImportTypeAssertionContainer, cbNode: (node: Node) => T | undefined, _cbNodes?: (nodes: NodeArray) => T | undefined): T | undefined { + return visitNode(cbNode, node.assertClause); }, [SyntaxKind.ParenthesizedType]: forEachChildInParenthesizedTypeOrTypeOperator, [SyntaxKind.TypeOperator]: forEachChildInParenthesizedTypeOrTypeOperator, @@ -4510,32 +4510,6 @@ namespace Parser { return token() === SyntaxKind.ImportKeyword; } - function parseImportTypeAttributes(): ImportTypeAttributes { - const pos = getNodePos(); - const openBracePosition = scanner.getTokenStart(); - parseExpected(SyntaxKind.OpenBraceToken); - const multiLine = scanner.hasPrecedingLineBreak(); - const currentToken = token(); - if (currentToken !== SyntaxKind.WithKeyword && currentToken !== SyntaxKind.AssertKeyword) { - parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(SyntaxKind.WithKeyword)); - } - else { - nextToken(); - } - parseExpected(SyntaxKind.ColonToken); - const attributes = parseImportAttributes(currentToken as SyntaxKind.WithKeyword | SyntaxKind.AssertKeyword, /*shouldAdvance*/ false); - if (!parseExpected(SyntaxKind.CloseBraceToken)) { - const lastError = lastOrUndefined(parseDiagnostics); - if (lastError && lastError.code === Diagnostics._0_expected.code) { - addRelatedInfo( - lastError, - createDetachedDiagnostic(fileName, sourceText, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"), - ); - } - } - return finishNode(factory.createImportTypeAttributes(attributes, multiLine), pos); - } - function parseImportType(): ImportTypeNode { sourceFlags |= NodeFlags.PossiblyContainsDynamicImport; const pos = getNodePos(); @@ -4543,9 +4517,28 @@ namespace Parser { parseExpected(SyntaxKind.ImportKeyword); parseExpected(SyntaxKind.OpenParenToken); const type = parseType(); - let attributes: ImportTypeAttributes | undefined; + let attributes: ImportAttributes | undefined; if (parseOptional(SyntaxKind.CommaToken)) { - attributes = parseImportTypeAttributes(); + const openBracePosition = scanner.getTokenStart(); + parseExpected(SyntaxKind.OpenBraceToken); + const currentToken = token(); + if (currentToken === SyntaxKind.WithKeyword || currentToken === SyntaxKind.AssertKeyword) { + nextToken(); + } + else { + parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(SyntaxKind.WithKeyword)); + } + parseExpected(SyntaxKind.ColonToken); + attributes = parseImportAttributes(currentToken as SyntaxKind.WithKeyword | SyntaxKind.AssertKeyword, /*skipKeyword*/ true); + if (!parseExpected(SyntaxKind.CloseBraceToken)) { + const lastError = lastOrUndefined(parseDiagnostics); + if (lastError && lastError.code === Diagnostics._0_expected.code) { + addRelatedInfo( + lastError, + createDetachedDiagnostic(fileName, sourceText, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}"), + ); + } + } } parseExpected(SyntaxKind.CloseParenToken); const qualifier = parseOptional(SyntaxKind.DotToken) ? parseEntityNameOfTypeReference() : undefined; @@ -8380,10 +8373,10 @@ namespace Parser { return finishNode(factory.createImportAttribute(name, value), pos); } - function parseImportAttributes(token: SyntaxKind.AssertKeyword | SyntaxKind.WithKeyword, shouldAdvance = true) { + function parseImportAttributes(token: SyntaxKind.AssertKeyword | SyntaxKind.WithKeyword, skipKeyword?: true) { const pos = getNodePos(); - if (shouldAdvance) { - nextToken(); + if (!skipKeyword) { + parseExpected(token); } const openBracePosition = scanner.getTokenStart(); if (parseExpected(SyntaxKind.OpenBraceToken)) { diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 0f359a893d9bc..98f15e1c0eacf 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -908,7 +908,7 @@ export function getModeForUsageLocation(file: { impliedNodeFormat?: ResolutionMo } } if (usage.parent.parent && isImportTypeNode(usage.parent.parent)) { - const override = getResolutionModeOverride(usage.parent.parent.attributes?.attributes); + const override = getResolutionModeOverride(usage.parent.parent.attributes); if (override) { return override; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index aa6de769dbeea..2ea84c9117301 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -379,10 +379,9 @@ export const enum SyntaxKind { ImportAttributes, ImportAttribute, - ImportTypeAttributes, /** @deprecated */ AssertClause = ImportAttributes, /** @deprecated */ AssertEntry = ImportAttribute, - /** @deprecated */ ImportTypeAssertionContainer = ImportTypeAttributes, + /** @deprecated */ ImportTypeAssertionContainer, // Property assignments PropertyAssignment, @@ -1061,7 +1060,6 @@ export type HasChildren = | InferTypeNode | ImportTypeNode | ImportTypeAssertionContainer - | ImportTypeAttributes | NamedTupleMember | ParenthesizedTypeNode | TypeOperatorNode @@ -2149,13 +2147,10 @@ export interface KeywordTypeNode, multiLine?: boolean): ImportAttributes; createImportAttribute(name: ImportAttributeName, value: Expression): ImportAttribute; updateImportAttribute(node: ImportAttribute, name: ImportAttributeName, value: Expression): ImportAttribute; - createImportTypeAttributes(attributes: ImportAttributes, multiLine?: boolean): ImportTypeAttributes; - updateImportTypeAttributes(node: ImportTypeAttributes, attributes: ImportAttributes, multiLine?: boolean): ImportTypeAttributes; createNamespaceImport(name: Identifier): NamespaceImport; updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport; createNamespaceExport(name: Identifier): NamespaceExport; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 4556af18b0099..fa083345c86e1 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -10458,5 +10458,5 @@ export function hasResolutionModeOverride(node: ImportTypeNode | ImportDeclarati if (node === undefined) { return false; } - return !!getResolutionModeOverride(isImportTypeNode(node) ? node.attributes?.attributes : node.attributes); + return !!getResolutionModeOverride(node.attributes); } diff --git a/src/compiler/visitorPublic.ts b/src/compiler/visitorPublic.ts index 963beb15459a1..c5e99d170911c 100644 --- a/src/compiler/visitorPublic.ts +++ b/src/compiler/visitorPublic.ts @@ -11,6 +11,7 @@ import { Identifier, isArray, isArrayBindingElement, + isAssertClause, isAssertsKeyword, isAsteriskToken, isAwaitKeyword, @@ -44,7 +45,6 @@ import { isImportAttributes, isImportClause, isImportSpecifier, - isImportTypeAttributes, isJsxAttributeLike, isJsxAttributeName, isJsxAttributes, @@ -894,17 +894,17 @@ const visitEachChildTable: VisitEachChildTable = { return context.factory.updateImportTypeNode( node, Debug.checkDefined(nodeVisitor(node.argument, visitor, isTypeNode)), - nodeVisitor(node.attributes, visitor, isImportTypeAttributes), + nodeVisitor(node.attributes, visitor, isImportAttributes), nodeVisitor(node.qualifier, visitor, isEntityName), nodesVisitor(node.typeArguments, visitor, isTypeNode), node.isTypeOf, ); }, - [SyntaxKind.ImportTypeAttributes]: function visitEachChildOfImportTypeAttributes(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { - return context.factory.updateImportTypeAttributes( + [SyntaxKind.ImportTypeAssertionContainer]: function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeAssertionContainer( node, - Debug.checkDefined(nodeVisitor(node.attributes, visitor, isImportAttributes)), + Debug.checkDefined(nodeVisitor(node.assertClause, visitor, isAssertClause)), node.multiLine, ); }, diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 06039459569d1..4644f238607fb 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4410,7 +4410,6 @@ declare namespace ts { CatchClause = 299, ImportAttributes = 300, ImportAttribute = 301, - ImportTypeAttributes = 302, /** @deprecated */ AssertClause = 300, /** @deprecated */ AssertEntry = 301, /** @deprecated */ ImportTypeAssertionContainer = 302, @@ -5145,12 +5144,10 @@ declare namespace ts { readonly kind: TKind; } /** @deprecated */ - type ImportTypeAssertionContainer = ImportTypeAttributes; - interface ImportTypeAttributes extends Node { - readonly kind: SyntaxKind.ImportTypeAttributes; + interface ImportTypeAssertionContainer extends Node { + readonly kind: SyntaxKind.ImportTypeAssertionContainer; readonly parent: ImportTypeNode; /** @deprecated */ readonly assertClause: AssertClause; - readonly attributes: ImportAttributes; readonly multiLine?: boolean; } interface ImportTypeNode extends NodeWithTypeArguments { @@ -5158,7 +5155,7 @@ declare namespace ts { readonly isTypeOf: boolean; readonly argument: TypeNode; /** @deprecated */ readonly assertions?: ImportTypeAssertionContainer; - readonly attributes?: ImportTypeAttributes; + readonly attributes?: ImportAttributes; readonly qualifier?: EntityName; } interface ThisTypeNode extends TypeNode { @@ -7966,8 +7963,8 @@ declare namespace ts { updateConditionalTypeNode(node: ConditionalTypeNode, checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode): ConditionalTypeNode; createInferTypeNode(typeParameter: TypeParameterDeclaration): InferTypeNode; updateInferTypeNode(node: InferTypeNode, typeParameter: TypeParameterDeclaration): InferTypeNode; - createImportTypeNode(argument: TypeNode, attributes?: ImportTypeAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; - updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, attributes: ImportTypeAttributes | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode; + createImportTypeNode(argument: TypeNode, attributes?: ImportAttributes, qualifier?: EntityName, typeArguments?: readonly TypeNode[], isTypeOf?: boolean): ImportTypeNode; + updateImportTypeNode(node: ImportTypeNode, argument: TypeNode, attributes: ImportAttributes | undefined, qualifier: EntityName | undefined, typeArguments: readonly TypeNode[] | undefined, isTypeOf?: boolean): ImportTypeNode; createParenthesizedType(type: TypeNode): ParenthesizedTypeNode; updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode; createThisTypeNode(): ThisTypeNode; @@ -8138,8 +8135,6 @@ declare namespace ts { updateImportAttributes(node: ImportAttributes, elements: NodeArray, multiLine?: boolean): ImportAttributes; createImportAttribute(name: ImportAttributeName, value: Expression): ImportAttribute; updateImportAttribute(node: ImportAttribute, name: ImportAttributeName, value: Expression): ImportAttribute; - createImportTypeAttributes(attributes: ImportAttributes, multiLine?: boolean): ImportTypeAttributes; - updateImportTypeAttributes(node: ImportTypeAttributes, attributes: ImportAttributes, multiLine?: boolean): ImportTypeAttributes; createNamespaceImport(name: Identifier): NamespaceImport; updateNamespaceImport(node: NamespaceImport, name: Identifier): NamespaceImport; createNamespaceExport(name: Identifier): NamespaceExport; @@ -9333,7 +9328,6 @@ declare namespace ts { function isImportDeclaration(node: Node): node is ImportDeclaration; function isImportClause(node: Node): node is ImportClause; function isImportTypeAssertionContainer(node: Node): node is ImportTypeAssertionContainer; - function isImportTypeAttributes(node: Node): node is ImportTypeAttributes; /** @deprecated */ function isAssertClause(node: Node): node is AssertClause; /** @deprecated */ From a990ddd8fa1d732db737b7dffdfafffeab10ac74 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Sat, 23 Sep 2023 00:08:36 +0300 Subject: [PATCH 20/21] remove deprecation diagnostic message --- src/compiler/checker.ts | 3 -- src/compiler/diagnosticMessages.json | 4 --- ...portAssertion1(module=commonjs).errors.txt | 19 ++--------- ...importAssertion1(module=es2015).errors.txt | 19 ++--------- ...importAssertion1(module=esnext).errors.txt | 19 ++--------- ...portAssertion2(module=commonjs).errors.txt | 22 ++---------- ...importAssertion2(module=es2015).errors.txt | 22 ++---------- ...importAssertion2(module=esnext).errors.txt | 34 ------------------- .../importAssertion2(module=esnext).types | 14 ++++---- ...importAssertion3(module=es2015).errors.txt | 16 ++------- ...importAssertion3(module=esnext).errors.txt | 16 ++------- .../importAssertionNonstring.errors.txt | 20 +---------- ...DeclarationEmit1(module=node16).errors.txt | 20 +---------- ...clarationEmit1(module=nodenext).errors.txt | 20 +---------- ...DeclarationEmit2(module=node16).errors.txt | 20 +---------- ...clarationEmit2(module=nodenext).errors.txt | 20 +---------- ...ationEmitErrors1(module=node16).errors.txt | 11 +----- ...ionEmitErrors1(module=nodenext).errors.txt | 11 +----- 18 files changed, 28 insertions(+), 282 deletions(-) delete mode 100644 tests/baselines/reference/importAssertion2(module=esnext).errors.txt diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 53f4fe506c08e..06be4262eedb2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -45134,9 +45134,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function checkImportAttributes(declaration: ImportDeclaration | ExportDeclaration) { - if (declaration.attributes && declaration.attributes.token === SyntaxKind.AssertKeyword) { - grammarErrorOnFirstToken(declaration.attributes, Diagnostics.The_assert_keyword_in_import_attributes_is_deprecated_and_has_been_replaced_by_the_with_keyword); - } const node = declaration.attributes; if (node) { const validForTypeAttributes = isExclusivelyTypeOnlyImportOrExport(declaration); diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 98dee5f2e4fff..35a4a9f54c206 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -19,10 +19,6 @@ "category": "Error", "code": 1007 }, - "The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword.": { - "category": "Error", - "code": 1008 - }, "Trailing comma not allowed.": { "category": "Error", "code": 1009 diff --git a/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt b/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt index 6c6386c9bf0b9..c937b51391439 100644 --- a/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt @@ -1,12 +1,7 @@ -1.ts(1,14): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(3,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. 3.ts(2,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. 3.ts(3,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'. @@ -23,20 +18,14 @@ export const a = 1; export const b = 2; -==== 1.ts (6 errors) ==== +==== 1.ts (3 errors) ==== import './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import { a, b } from './0' assert { "type": "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import * as foo from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. a; @@ -44,15 +33,11 @@ foo.a; foo.b; -==== 2.ts (4 errors) ==== +==== 2.ts (2 errors) ==== import { a, b } from './0' assert {} - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. a; diff --git a/tests/baselines/reference/importAssertion1(module=es2015).errors.txt b/tests/baselines/reference/importAssertion1(module=es2015).errors.txt index a60d56281e1c3..44aeede5b994c 100644 --- a/tests/baselines/reference/importAssertion1(module=es2015).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=es2015).errors.txt @@ -1,12 +1,7 @@ -1.ts(1,14): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(3,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. 3.ts(1,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. 3.ts(2,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'. @@ -23,20 +18,14 @@ export const a = 1; export const b = 2; -==== 1.ts (6 errors) ==== +==== 1.ts (3 errors) ==== import './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import { a, b } from './0' assert { "type": "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import * as foo from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. a; @@ -44,15 +33,11 @@ foo.a; foo.b; -==== 2.ts (4 errors) ==== +==== 2.ts (2 errors) ==== import { a, b } from './0' assert {} - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. a; diff --git a/tests/baselines/reference/importAssertion1(module=esnext).errors.txt b/tests/baselines/reference/importAssertion1(module=esnext).errors.txt index ef3a0577ab588..e8100730813c4 100644 --- a/tests/baselines/reference/importAssertion1(module=esnext).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=esnext).errors.txt @@ -1,8 +1,3 @@ -1.ts(1,14): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -1.ts(3,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 3.ts(8,11): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments 3.ts(9,11): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments @@ -11,28 +6,18 @@ export const a = 1; export const b = 2; -==== 1.ts (3 errors) ==== +==== 1.ts (0 errors) ==== import './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. import { a, b } from './0' assert { "type": "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. import * as foo from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. a; b; foo.a; foo.b; -==== 2.ts (2 errors) ==== +==== 2.ts (0 errors) ==== import { a, b } from './0' assert {} - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. a; b; c; diff --git a/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt b/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt index 5a6418d13216a..e902dce6562c6 100644 --- a/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt +++ b/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt @@ -1,14 +1,8 @@ -1.ts(1,22): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(1,22): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(3,21): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(4,27): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. @@ -16,37 +10,25 @@ export const a = 1; export const b = 2; -==== 1.ts (8 errors) ==== +==== 1.ts (4 errors) ==== export {} from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export { a, b } from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export * from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export * as ns from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -==== 2.ts (4 errors) ==== +==== 2.ts (2 errors) ==== export { a, b } from './0' assert {} - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion2(module=es2015).errors.txt b/tests/baselines/reference/importAssertion2(module=es2015).errors.txt index 5a6418d13216a..e902dce6562c6 100644 --- a/tests/baselines/reference/importAssertion2(module=es2015).errors.txt +++ b/tests/baselines/reference/importAssertion2(module=es2015).errors.txt @@ -1,14 +1,8 @@ -1.ts(1,22): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(1,22): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(3,21): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(4,27): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. @@ -16,37 +10,25 @@ export const a = 1; export const b = 2; -==== 1.ts (8 errors) ==== +==== 1.ts (4 errors) ==== export {} from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export { a, b } from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export * from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export * as ns from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -==== 2.ts (4 errors) ==== +==== 2.ts (2 errors) ==== export { a, b } from './0' assert {} - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion2(module=esnext).errors.txt b/tests/baselines/reference/importAssertion2(module=esnext).errors.txt deleted file mode 100644 index 8bc2a04097e3d..0000000000000 --- a/tests/baselines/reference/importAssertion2(module=esnext).errors.txt +++ /dev/null @@ -1,34 +0,0 @@ -1.ts(1,22): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -1.ts(2,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -1.ts(3,21): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -1.ts(4,27): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -2.ts(1,28): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -2.ts(2,38): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. - - -==== 0.ts (0 errors) ==== - export const a = 1; - export const b = 2; - -==== 1.ts (4 errors) ==== - export {} from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. - export { a, b } from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. - export * from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. - export * as ns from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. - -==== 2.ts (2 errors) ==== - export { a, b } from './0' assert {} - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. - export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. - \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion2(module=esnext).types b/tests/baselines/reference/importAssertion2(module=esnext).types index f917bb2b1e47d..6d17f2a988e8c 100644 --- a/tests/baselines/reference/importAssertion2(module=esnext).types +++ b/tests/baselines/reference/importAssertion2(module=esnext).types @@ -11,19 +11,19 @@ export const b = 2; === 1.ts === export {} from './0' assert { type: "json" } ->type : any +>type : error export { a, b } from './0' assert { type: "json" } >a : 1 >b : 2 ->type : any +>type : error export * from './0' assert { type: "json" } ->type : any +>type : error export * as ns from './0' assert { type: "json" } >ns : typeof import("0") ->type : any +>type : error === 2.ts === export { a, b } from './0' assert {} @@ -35,7 +35,7 @@ export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } >c : 1 >b : 2 >d : 2 ->a : any ->b : any ->c : any +>a : error +>b : error +>c : error diff --git a/tests/baselines/reference/importAssertion3(module=es2015).errors.txt b/tests/baselines/reference/importAssertion3(module=es2015).errors.txt index 639877e41d115..05054102cd71a 100644 --- a/tests/baselines/reference/importAssertion3(module=es2015).errors.txt +++ b/tests/baselines/reference/importAssertion3(module=es2015).errors.txt @@ -1,37 +1,25 @@ -1.ts(1,27): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(1,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -1.ts(2,30): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(2,30): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(1,31): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(1,31): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -2.ts(2,33): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(2,33): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ==== 0.ts (0 errors) ==== export interface I { } -==== 1.ts (4 errors) ==== +==== 1.ts (2 errors) ==== export type {} from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export type { I } from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -==== 2.ts (4 errors) ==== +==== 2.ts (2 errors) ==== import type { I } from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import type * as foo from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. diff --git a/tests/baselines/reference/importAssertion3(module=esnext).errors.txt b/tests/baselines/reference/importAssertion3(module=esnext).errors.txt index 47b48e70673c7..1d754165a3df6 100644 --- a/tests/baselines/reference/importAssertion3(module=esnext).errors.txt +++ b/tests/baselines/reference/importAssertion3(module=esnext).errors.txt @@ -1,37 +1,25 @@ -1.ts(1,27): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(1,27): error TS2822: Import assertions cannot be used with type-only imports or exports. -1.ts(2,30): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 1.ts(2,30): error TS2822: Import assertions cannot be used with type-only imports or exports. -2.ts(1,31): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(1,31): error TS2822: Import assertions cannot be used with type-only imports or exports. -2.ts(2,33): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. 2.ts(2,33): error TS2822: Import assertions cannot be used with type-only imports or exports. ==== 0.ts (0 errors) ==== export interface I { } -==== 1.ts (4 errors) ==== +==== 1.ts (2 errors) ==== export type {} from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2822: Import assertions cannot be used with type-only imports or exports. export type { I } from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2822: Import assertions cannot be used with type-only imports or exports. -==== 2.ts (4 errors) ==== +==== 2.ts (2 errors) ==== import type { I } from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2822: Import assertions cannot be used with type-only imports or exports. import type * as foo from './0' assert { type: "json" } - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2822: Import assertions cannot be used with type-only imports or exports. diff --git a/tests/baselines/reference/importAssertionNonstring.errors.txt b/tests/baselines/reference/importAssertionNonstring.errors.txt index 0ddc2d24061c9..bb55e2a13bc1d 100644 --- a/tests/baselines/reference/importAssertionNonstring.errors.txt +++ b/tests/baselines/reference/importAssertionNonstring.errors.txt @@ -1,50 +1,32 @@ -mod.mts(1,37): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. mod.mts(1,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(3,37): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. mod.mts(3,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(5,37): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. mod.mts(5,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(7,37): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. mod.mts(7,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(9,37): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. mod.mts(9,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(11,37): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. mod.mts(11,66): error TS2837: Import assertion values must be string literal expressions. -==== mod.mts (12 errors) ==== +==== mod.mts (6 errors) ==== import * as thing1 from "./mod.mjs" assert {field: 0}; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing2 from "./mod.mjs" assert {field: `a`}; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing3 from "./mod.mjs" assert {field: /a/g}; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing4 from "./mod.mjs" assert {field: ["a"]}; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing5 from "./mod.mjs" assert {field: { a: 0 }}; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~ !!! error TS2837: Import assertion values must be string literal expressions. import * as thing6 from "./mod.mjs" assert {type: "json", field: 0..toString()} - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~ !!! error TS2837: Import assertion values must be string literal expressions. \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt index 95e54e348830c..a8a76a05152b7 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt @@ -1,44 +1,26 @@ -/index.ts(1,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -/index.ts(2,44): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -/index.ts(6,50): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -/index.ts(10,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -/index.ts(11,44): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -==== /index.ts (9 errors) ==== +==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt index cba0aa59ef9e7..dd57016e6b7d1 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt @@ -1,44 +1,26 @@ -/index.ts(1,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -/index.ts(2,44): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -/index.ts(6,50): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(6,50): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(7,49): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. -/index.ts(10,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -/index.ts(11,44): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -==== /index.ts (9 errors) ==== +==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt index bb79ece0f8c8d..0403a6e026ffe 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt @@ -1,44 +1,26 @@ -/index.ts(1,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -/index.ts(2,44): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -/index.ts(6,50): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -/index.ts(7,49): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -/index.ts(10,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -/index.ts(11,44): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -==== /index.ts (9 errors) ==== +==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt index bc5dbb52a172d..47c2ad040c0db 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt @@ -1,44 +1,26 @@ -/index.ts(1,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -/index.ts(2,44): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -/index.ts(6,50): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(7,49): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. -/index.ts(10,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -/index.ts(11,44): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -==== /index.ts (9 errors) ==== +==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1454: `resolution-mode` can only be set for type-only imports. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1454: `resolution-mode` can only be set for type-only imports. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt index 8f2854edf434e..bc3eb30565c6f 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt @@ -1,18 +1,13 @@ -/index.ts(2,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(2,45): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(4,39): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(4,39): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -/index.ts(6,76): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(6,76): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -==== /index.ts (8 errors) ==== +==== /index.ts (5 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. ~~~~~~~~ @@ -21,14 +16,10 @@ import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt index 5857b0648bf3c..98a0b7fcfa6f7 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt @@ -1,18 +1,13 @@ -/index.ts(2,45): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(2,45): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(4,39): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(4,39): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. -/index.ts(6,76): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. /index.ts(6,76): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. -==== /index.ts (8 errors) ==== +==== /index.ts (5 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. ~~~~~~~~ @@ -21,14 +16,10 @@ import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. From de897d4a69fda69176ba25abfe5c7a11ff04a69d Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Sat, 23 Sep 2023 00:45:09 +0300 Subject: [PATCH 21/21] update baseline --- ...deModulesImportAssertions(module=node16).errors.txt | 10 ++-------- ...ModulesImportAssertions(module=nodenext).errors.txt | 10 ++-------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt index d8cb3cc4a4bc7..9aec13e27c5a5 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt @@ -1,22 +1,16 @@ error TS2468: Cannot find global value 'Promise'. -index.ts(1,35): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. index.ts(1,35): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -otherc.cts(1,35): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. otherc.cts(1,35): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. otherc.cts(2,15): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. !!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (2 errors) ==== +==== index.ts (1 errors) ==== import json from "./package.json" assert { type: "json" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -==== otherc.cts (3 errors) ==== +==== otherc.cts (2 errors) ==== import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).errors.txt index 0e95c13d77262..19217bd404ddb 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).errors.txt @@ -1,19 +1,13 @@ error TS2468: Cannot find global value 'Promise'. -index.ts(1,35): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -otherc.cts(1,35): error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. otherc.cts(1,35): error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. otherc.cts(2,15): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. !!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (1 errors) ==== +==== index.ts (0 errors) ==== import json from "./package.json" assert { type: "json" }; - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. -==== otherc.cts (3 errors) ==== +==== otherc.cts (2 errors) ==== import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions - ~~~~~~ -!!! error TS1008: The 'assert' keyword in import attributes is deprecated and has been replaced by the 'with' keyword. ~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to CommonJS 'require' calls. const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine