tsconfig / bases

Hosts TSConfigs to extend in a TypeScript app, tuned to a particular runtime environment
MIT License
6.4k stars 240 forks source link

Svelte tsconfig seems to be incomplete #194

Closed gvlasov closed 1 year ago

gvlasov commented 1 year ago

I added @tsconfig/svelte^3.0.0 as a dev dependency, but my code wouldn't compile, saying

ERROR in ./src/main.ts (/path/src/main.ts) 2:16-30
[tsl] ERROR in /path/src/main.ts(2,17)
      TS2307: Cannot find module './App.svelte' or its corresponding type declarations.

in this file

import './global.less';
import App from './App.svelte'; // <---- Here

const app = new App({
    target: document.body
});

export default app;

until I added

"compilerOptions": {
    "types": ["svelte"]
}

to my tsconfig. Shouldn't this option be included in @tsconfig/svelte?

orta commented 1 year ago

/cc @dummdidumm

dummdidumm commented 1 year ago

This was the way in @tsconfig/svelte 1.0 but was removed because then you'd lock out all other types that should be loaded eagerly. The recommended way to do it is to add /// <reference types="svelte" /> to a d.ts file instead. See the PR which changed this for more info #55