// foo.ts
declare global {
const a: number
}
export { }
// bar.ts
console.log(a) // error: Cannot find name 'a'.
to reproduce
- close
foo.ts in vscode
- restart the deno language server
- wait for the error to appear in
bar.ts
- open
foo.ts and watch the error disappear
vscode's built in typescript language server seems to have the same issue but creating a tsconfig.json file fixes it because it allows it to detect which files to include in the project without having to rely on which files the user opens.
in deno-ts however, doing the equivalent with deno.jsonc does not seem to have any impact.
deno check does not report any error.
workaround
add an import './foo.ts' or /// <reference path="./foo.ts" /> to the top of bar.ts, but this shouldn't be necessary since it should just use the typescript settings in deno.jsonc to determine which files to include in the project
Version: Deno 2.7.11
to reproduce
foo.tsin vscodebar.tsfoo.tsand watch the error disappearvscode's built in typescript language server seems to have the same issue but creating a
tsconfig.jsonfile fixes it because it allows it to detect which files to include in the project without having to rely on which files the user opens.in
deno-tshowever, doing the equivalent withdeno.jsoncdoes not seem to have any impact.deno checkdoes not report any error.workaround
add an
import './foo.ts'or/// <reference path="./foo.ts" />to the top ofbar.ts, but this shouldn't be necessary since it should just use the typescript settings indeno.jsoncto determine which files to include in the projectVersion: Deno 2.7.11