Pick PR #49356 (Add nightly-only error on ImportType resolution mode assertion) into release-4.7 (#49365)

* Add nightly-only error on ImportType resolution mode assertion (#49356)

* Add nightly-only error on ImportType resolution mode assertion

* Temporarily change version to demonstrate errors

* Revert "Temporarily change version to demonstrate errors"

This reverts commit 40c2469647f129ea088a16d60f3f070f9f5beeb2.

* "Resolution mode" -> "resolution-mode"

* Update baselines
This commit is contained in:
Andrew Branch 2022-06-02 16:25:52 -07:00 committed by GitHub
parent 5f7f0b1d57
commit 3bf0d30686
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 257 additions and 102 deletions

View File

@ -6199,6 +6199,7 @@ namespace ts {
factory.createStringLiteral("import")
)
])));
context.tracker.reportImportTypeNodeResolutionModeOverride?.();
}
}
if (!specifier) {
@ -6222,6 +6223,7 @@ namespace ts {
factory.createStringLiteral(swappedMode === ModuleKind.ESNext ? "import" : "require")
)
])));
context.tracker.reportImportTypeNodeResolutionModeOverride?.();
}
}
@ -35825,8 +35827,11 @@ namespace ts {
if (node.assertions) {
const override = getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
if (override) {
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);
}
if (getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Node16 && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.NodeNext) {
grammarErrorOnNode(node.assertions.assertClause, Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
grammarErrorOnNode(node.assertions.assertClause, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
}
}
}
@ -40720,11 +40725,11 @@ namespace ts {
const override = getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
if (validForTypeAssertions && 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(declaration.assertClause, 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_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
return grammarErrorOnNode(declaration.assertClause, 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
}

View File

@ -1424,7 +1424,7 @@
"category": "Error",
"code": 1451
},
"Resolution modes are only supported when `moduleResolution` is `node16` or `nodenext`.": {
"'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`.": {
"category": "Error",
"code": 1452
},
@ -3451,6 +3451,10 @@
"category": "Error",
"code": 2838
},
"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
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
@ -3880,7 +3884,7 @@
"category": "Error",
"code": 4124
},
"Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.": {
"'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.": {
"category": "Error",
"code": 4125
},

View File

@ -3116,7 +3116,7 @@ namespace ts {
setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
const mode = ref.resolutionMode || file.impliedNodeFormat;
if (mode && getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Node16 && getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeNext) {
programDiagnostics.add(createDiagnosticForRange(file, ref, Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
programDiagnostics.add(createDiagnosticForRange(file, ref, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
}
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: FileIncludeKind.TypeReferenceDirective, file: file.path, index, });
}

View File

@ -78,7 +78,8 @@ namespace ts {
trackReferencedAmbientModule,
trackExternalModuleSymbolOfImportTypeNode,
reportNonlocalAugmentation,
reportNonSerializableProperty
reportNonSerializableProperty,
reportImportTypeNodeResolutionModeOverride,
};
let errorNameNode: DeclarationName | undefined;
let errorFallbackNode: Declaration | undefined;
@ -235,6 +236,12 @@ namespace ts {
}
}
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) : ({
@ -792,7 +799,7 @@ namespace ts {
const mode = getResolutionModeOverrideForClause(assertClause);
if (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(assertClause!, Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next));
}
return assertClause;
}

View File

@ -8511,6 +8511,7 @@ namespace ts {
trackExternalModuleSymbolOfImportTypeNode?(symbol: Symbol): void;
reportNonlocalAugmentation?(containingFile: SourceFile, parentSymbol: Symbol, augmentingSymbol: Symbol): void;
reportNonSerializableProperty?(propertyName: string): void;
reportImportTypeNodeResolutionModeOverride?(): void;
}
export interface TextSpan {

View File

@ -0,0 +1,80 @@
tests/cases/conformance/node/other.cts(3,14): error TS2841: 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'.
tests/cases/conformance/node/other.cts(4,14): error TS2841: 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'.
tests/cases/conformance/node/other2.cts(3,14): error TS2841: 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'.
==== tests/cases/conformance/node/index.ts (0 errors) ====
// esm format file
export {};
==== tests/cases/conformance/node/index.mts (0 errors) ====
// esm format file
export {};
==== tests/cases/conformance/node/index.cts (0 errors) ====
// cjs format file
export {};
==== tests/cases/conformance/node/other.ts (0 errors) ====
// esm format file
export const a = await import("package/cjs");
export const b = await import("package/mjs");
export const c = await import("package");
export const f = await import("inner");
==== tests/cases/conformance/node/other2.ts (0 errors) ====
// esm format file
export const d = await import("inner/cjs");
export const e = await import("inner/mjs");
==== tests/cases/conformance/node/other.mts (0 errors) ====
// esm format file
export const a = await import("package/cjs");
export const b = await import("package/mjs");
export const c = await import("package");
export const f = await import("inner");
==== tests/cases/conformance/node/other2.mts (0 errors) ====
// esm format file
export const d = await import("inner/cjs");
export const e = await import("inner/mjs");
==== tests/cases/conformance/node/other.cts (2 errors) ====
// cjs format file, no TLA
export const a = import("package/cjs");
export const b = import("package/mjs");
~
!!! error TS2841: 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'.
export const c = import("package");
~
!!! error TS2841: 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'.
export const f = import("inner");
==== tests/cases/conformance/node/other2.cts (1 errors) ====
// cjs format file, no TLA
export const d = import("inner/cjs");
export const e = import("inner/mjs");
~
!!! error TS2841: 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'.
==== tests/cases/conformance/node/node_modules/inner/index.d.ts (0 errors) ====
// cjs format file
export const cjsMain = true;
==== tests/cases/conformance/node/node_modules/inner/index.d.mts (0 errors) ====
// esm format file
export const esm = true;
==== tests/cases/conformance/node/node_modules/inner/index.d.cts (0 errors) ====
// cjs format file
export const cjsNonmain = true;
==== tests/cases/conformance/node/package.json (0 errors) ====
{
"name": "package",
"private": true,
"type": "module",
"exports": {
"./cjs": "./index.cjs",
"./mjs": "./index.mjs",
".": "./index.js"
}
}
==== tests/cases/conformance/node/node_modules/inner/package.json (0 errors) ====
{
"name": "inner",
"private": true,
"exports": {
"./cjs": "./index.cjs",
"./mjs": "./index.mjs",
".": "./index.js"
}
}

View File

@ -153,19 +153,3 @@ export declare const d: {
cjsNonmain: true;
};
export declare const e: typeof import("inner/mjs");
//// [other.d.cts]
export declare const a: Promise<{
default: typeof import("./index.cjs");
}>;
export declare const b: Promise<typeof import("./index.mjs", { assert: { "resolution-mode": "import" } })>;
export declare const c: Promise<typeof import("./index.js", { assert: { "resolution-mode": "import" } })>;
export declare const f: Promise<{
default: typeof import("inner");
cjsMain: true;
}>;
//// [other2.d.cts]
export declare const d: Promise<{
default: typeof import("inner/cjs");
cjsNonmain: true;
}>;
export declare const e: Promise<typeof import("inner/mjs", { assert: { "resolution-mode": "import" } })>;

View File

@ -1,21 +1,21 @@
/index.ts(1,45): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(2,44): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(1,45): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(2,44): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
/index.ts(6,50): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(6,50): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'.
/index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
/index.ts(7,49): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(10,45): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(11,44): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(7,49): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(10,45): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(11,44): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
==== /index.ts (9 errors) ====
import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export interface LocalInterface extends RequireInterface, ImportInterface {}
@ -23,22 +23,22 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" };
~~~~~~~~~~~~~~~
!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export interface Loc extends Req, Imp {}
export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
==== /node_modules/pkg/package.json (0 errors) ====
{

View File

@ -1,21 +1,21 @@
/index.ts(1,45): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(2,44): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(1,45): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(2,44): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls.
/index.ts(6,50): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(6,50): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'.
/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls.
/index.ts(7,49): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(10,45): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(11,44): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(7,49): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(10,45): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(11,44): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
==== /index.ts (9 errors) ====
import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export interface LocalInterface extends RequireInterface, ImportInterface {}
@ -23,22 +23,22 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" };
~~~~~~~~~~~~~~~
!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export interface Loc extends Req, Imp {}
export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
==== /node_modules/pkg/package.json (0 errors) ====
{

View File

@ -1,21 +1,21 @@
/index.ts(1,45): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(2,44): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(1,45): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(2,44): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'.
/index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
/index.ts(6,50): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(6,50): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
/index.ts(7,49): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(10,45): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(11,44): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(7,49): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(10,45): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(11,44): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
==== /index.ts (9 errors) ====
import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export interface LocalInterface extends RequireInterface, ImportInterface {}
@ -25,20 +25,20 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export interface Loc extends Req, Imp {}
export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
==== /node_modules/pkg/package.json (0 errors) ====
{

View File

@ -1,21 +1,21 @@
/index.ts(1,45): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(2,44): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(1,45): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(2,44): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/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(6,50): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(6,50): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports.
/index.ts(7,49): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(10,45): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(11,44): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(7,49): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(10,45): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(11,44): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
==== /index.ts (9 errors) ====
import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export interface LocalInterface extends RequireInterface, ImportInterface {}
@ -25,20 +25,20 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1454: `resolution-mode` can only be set for type-only imports.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1454: `resolution-mode` can only be set for type-only imports.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export interface Loc extends Req, Imp {}
export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
==== /node_modules/pkg/package.json (0 errors) ====
{

View File

@ -2,7 +2,7 @@
/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 TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
/index.ts(4,39): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(4,39): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(6,76): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
@ -20,7 +20,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
// not exclusively type-only
import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -2,7 +2,7 @@
/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 TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls.
/index.ts(4,39): error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(4,39): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(6,76): error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls.
@ -20,7 +20,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
// not exclusively type-only
import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -0,0 +1,38 @@
/index.ts(2,31): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(3,31): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(5,58): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(6,14): error TS2841: 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'.
/index.ts(6,58): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
==== /index.ts (5 errors) ====
export type LocalInterface =
& import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
& import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface);
~
!!! error TS2841: 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'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
==== /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 {}

View File

@ -28,9 +28,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.b = exports.a = void 0;
exports.a = null;
exports.b = null;
//// [index.d.ts]
export declare 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;

View File

@ -0,0 +1,38 @@
/index.ts(2,31): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(3,31): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(5,58): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(6,14): error TS2841: 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'.
/index.ts(6,58): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
==== /index.ts (5 errors) ====
export type LocalInterface =
& import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
& import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface);
~
!!! error TS2841: 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'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
==== /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 {}

View File

@ -28,9 +28,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.b = exports.a = void 0;
exports.a = null;
exports.b = null;
//// [index.d.ts]
export declare 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;

View File

@ -1,5 +1,8 @@
/index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`.
/index.ts(3,31): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`.
/index.ts(6,14): error TS2841: 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'.
/index.ts(6,58): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/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,39): error TS1005: ';' expected.
@ -89,17 +92,23 @@
export interface ImportInterface {}
==== /node_modules/pkg/require.d.ts (0 errors) ====
export interface RequireInterface {}
==== /index.ts (2 errors) ====
==== /index.ts (5 errors) ====
export type LocalInterface =
& import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface
~~~~~~~~
!!! error TS1453: `resolution-mode` should be either `require` or `import`.
& import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface);
~~~~~~~~
!!! error TS1453: `resolution-mode` should be either `require` or `import`.
export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface);
~
!!! error TS2841: 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'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
==== /other.ts (27 errors) ====
// missing assert:
export type LocalInterface =

View File

@ -119,10 +119,6 @@ exports.a = null;
exports.b = null;
//// [index.d.ts]
export declare 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;
//// [other.d.ts]
export declare type LocalInterface = import("pkg", { assert: {} });
export declare const a: any;

View File

@ -1,5 +1,8 @@
/index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`.
/index.ts(3,31): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`.
/index.ts(6,14): error TS2841: 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'.
/index.ts(6,58): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
/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,39): error TS1005: ';' expected.
@ -89,17 +92,23 @@
export interface ImportInterface {}
==== /node_modules/pkg/require.d.ts (0 errors) ====
export interface RequireInterface {}
==== /index.ts (2 errors) ====
==== /index.ts (5 errors) ====
export type LocalInterface =
& import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface
~~~~~~~~
!!! error TS1453: `resolution-mode` should be either `require` or `import`.
& import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface);
~~~~~~~~
!!! error TS1453: `resolution-mode` should be either `require` or `import`.
export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface);
~
!!! error TS2841: 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'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'.
==== /other.ts (27 errors) ====
// missing assert:
export type LocalInterface =

View File

@ -119,10 +119,6 @@ exports.a = null;
exports.b = null;
//// [index.d.ts]
export declare 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;
//// [other.d.ts]
export declare type LocalInterface = import("pkg", { assert: {} });
export declare const a: any;

View File

@ -1,6 +1,6 @@
/index.ts(1,23): error TS1452: Resolution modes are only supported when `moduleResolution` is `node16` or `nodenext`.
/index.ts(1,23): error TS1452: 'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`.
/index.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'.
/index.ts(2,23): error TS1452: Resolution modes are only supported when `moduleResolution` is `node16` or `nodenext`.
/index.ts(2,23): error TS1452: 'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`.
/index.ts(2,23): error TS2688: Cannot find type definition file for 'pkg'.
/index.ts(3,1): error TS2304: Cannot find name 'foo'.
/index.ts(4,1): error TS2304: Cannot find name 'bar'.
@ -9,12 +9,12 @@
==== /index.ts (6 errors) ====
/// <reference types="pkg" resolution-mode="require" />
~~~
!!! error TS1452: Resolution modes are only supported when `moduleResolution` is `node16` or `nodenext`.
!!! error TS1452: 'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`.
~~~
!!! error TS2688: Cannot find type definition file for 'pkg'.
/// <reference types="pkg" resolution-mode="import" />
~~~
!!! error TS1452: Resolution modes are only supported when `moduleResolution` is `node16` or `nodenext`.
!!! error TS1452: 'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`.
~~~
!!! error TS2688: Cannot find type definition file for 'pkg'.
foo; // `resolution-mode` is an error in old resolution settings, which resolves is arbitrary