diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-04-15 17:50:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-15 17:50:52 -0400 |
commit | 6f278e5c40d101f0fb8e7b69e28d34b1c766a8fe (patch) | |
tree | 97d3edc0f0b527c3dc7f07ba71d5828cd2c77943 /tests/specs/npm | |
parent | 7e4ee02e2e37db8adfaf4a05aba3819838904650 (diff) |
fix(lsp): improved cjs tracking (#23374)
Our cjs tracking was a bit broken. It was marking stuff as esm that was
actually cjs leading to type checking errors.
Diffstat (limited to 'tests/specs/npm')
4 files changed, 28 insertions, 0 deletions
diff --git a/tests/specs/npm/cjs_internal_types_default_export/__test__.jsonc b/tests/specs/npm/cjs_internal_types_default_export/__test__.jsonc new file mode 100644 index 000000000..dc8aabedb --- /dev/null +++ b/tests/specs/npm/cjs_internal_types_default_export/__test__.jsonc @@ -0,0 +1,15 @@ +{ + "tempDir": true, + "envs": { + "DENO_FUTURE": "1" + }, + "steps": [{ + "commandName": "npm", + "args": "install", + "output": "[WILDCARD]" + }, { + "args": "check main.ts", + "exitCode": 1, + "output": "main.out" + }] +} diff --git a/tests/specs/npm/cjs_internal_types_default_export/main.out b/tests/specs/npm/cjs_internal_types_default_export/main.out new file mode 100644 index 000000000..66ec3f37b --- /dev/null +++ b/tests/specs/npm/cjs_internal_types_default_export/main.out @@ -0,0 +1,5 @@ +Check file:///[WILDLINE]/main.ts +error: TS2345 [ERROR]: Argument of type 'string' is not assignable to parameter of type 'number'. +add(1, "test"); // should error + ~~~~~~ + at file:///[WILDLINE]/main.ts:3:8 diff --git a/tests/specs/npm/cjs_internal_types_default_export/main.ts b/tests/specs/npm/cjs_internal_types_default_export/main.ts new file mode 100644 index 000000000..339efcc59 --- /dev/null +++ b/tests/specs/npm/cjs_internal_types_default_export/main.ts @@ -0,0 +1,3 @@ +import { add } from "@denotest/cjs-internal-types-default-export"; + +add(1, "test"); // should error diff --git a/tests/specs/npm/cjs_internal_types_default_export/package.json b/tests/specs/npm/cjs_internal_types_default_export/package.json new file mode 100644 index 000000000..f97b7b565 --- /dev/null +++ b/tests/specs/npm/cjs_internal_types_default_export/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@denotest/cjs-internal-types-default-export": "*" + } +} |