4 ms·
Here is a minimum "repro" of your use case: tsconfig.json { "include": ["index.d.ts"], "compilerOptions": { "target": "es2015",
by ht85 4y ago
Here is a minimum "repro" of your use case:
tsconfig.json
{
"include": ["index.d.ts"],
"compilerOptions": {
"target": "es2015",
"lib": ["es2015", "dom"],
"moduleResolution": "node",
"allowSyntheticDefaultImports": true
}
}
index.d.ts
import * as PIXI from 'pixi.js'
declare global {
interface Window {
PIXI: typeof PIXI
}
}
index.ts
console.log(window.PIXI)
There is still an import but because it is in the .d.ts file it won't be included in the runtime code.
- umvi 4y agoThank you very much for posting this! I just tested this and it does exactly what I wanted - to get full type checking including 3rd party libs without having to convert all my existing files to be modules. I owe you a beverage of choice-