deno: deno check panicked when "exclude" contains folder with d.ts file in compilerOptions.types (in deno.json)
Version: Deno 1.39.3 (issue found in 1.39.2)
The command
deno check lib/utils.ts
causes error:
============================================================ Deno has panicked. This is a bug in Deno. Please report this at https://github.com/denoland/deno/issues/new. If you can reliably reproduce this panic, include the reproduction steps and re-run with the RUST_BACKTRACE=1 env var set and include the backtrace in your report.
Platform: macos aarch64 Version: 1.39.3 Args: [“deno”, “check”, “lib/utils.ts”]
thread ‘main’ panicked at cli/tools/check.rs:150:41: index out of bounds: the len is 0 but the index is 0 note: run with
RUST_BACKTRACE=1environment variable to display a backtrace
Folders structure:
lib
- index.d.ts
- utils.ts
deno.json
deno.json:
{
"compilerOptions": {
"types": ["./lib/index.d.ts"]
},
"exclude": ["lib"]
}
index.d.ts
interface ISample {
value: number;
}
utils.ts
export function calc(data: ISample) {
return data.value + 3;
}
Expected behavior:
deno check lib/utils.ts does not result in deno panick.
Proposed behavior: As the “lib” folder is in the “exclude” list and we are trying to check files in this folder, the provided deno.json configuration makes no sense (but stays syntactically correct). But deno runtime could give some meaningful message about that or just standard “no matches found:” without panicking.
About this issue
- Original URL
- State: closed
- Created 6 months ago
- Comments: 15 (8 by maintainers)
Commits related to this issue
- fix(check): should not panic when all specified files excluded (#21929) Closes #21926 — committed to denoland/deno by dsherret 6 months ago
- fix(check): should not panic when all specified files excluded (#21929) Closes #21926 — committed to denoland/deno by dsherret 6 months ago
It’s related to the fix https://github.com/denoland/deno/pull/21922.
In the meantime, you can remove the
./from the paths you use in deno.json to workaround the issue.