mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 18:38:33 +00:00
fix(npm): support bare specifiers in package.json having a path (#17903)
For example `import * as test from "package/path.js"`
This commit is contained in:
parent
344317ec50
commit
6233c0aff0
8 changed files with 110 additions and 20 deletions
|
@ -1,2 +1,3 @@
|
|||
2
|
||||
2
|
||||
2
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
import * as myImport1 from "@denotest/esm-basic";
|
||||
import * as myImport2 from "./node_modules/@denotest/esm-basic/main.mjs";
|
||||
import * as myImport3 from "@denotest/esm-basic/main.mjs";
|
||||
|
||||
myImport1.setValue(5);
|
||||
myImport2.setValue(2);
|
||||
|
||||
// these should both give type errors
|
||||
// these should all give type errors
|
||||
const value1: string = myImport1.getValue();
|
||||
const value2: string = myImport2.getValue();
|
||||
const value3: string = myImport3.getValue();
|
||||
|
||||
// these should both be equal because it should be mutating the same module
|
||||
// these should all be equal because it should be mutating the same module
|
||||
console.log(value1);
|
||||
console.log(value2);
|
||||
console.log(value3);
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
|
||||
const value1: string = myImport1.getValue();
|
||||
~~~~~~
|
||||
at file:///[WILDCARD]/npm/node_modules_import/main.ts:8:7
|
||||
at file:///[WILDCARD]/npm/node_modules_import/main.ts:9:7
|
||||
|
||||
TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
|
||||
const value2: string = myImport2.getValue();
|
||||
~~~~~~
|
||||
at file:///[WILDCARD]/npm/node_modules_import/main.ts:9:7
|
||||
at file:///[WILDCARD]/npm/node_modules_import/main.ts:10:7
|
||||
|
||||
Found 2 errors.
|
||||
TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
|
||||
const value3: string = myImport3.getValue();
|
||||
~~~~~~
|
||||
at file:///[WILDCARD]/npm/node_modules_import/main.ts:11:7
|
||||
|
||||
Found 3 errors.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue