Move web tsconfig to let TS language server work (#506)

* Move `web` tsconfig to let TS language server work

* Assign typing to images

This removes type errors on imported images.
This commit is contained in:
Andrew Ferrazzutti 2022-09-30 12:35:53 -04:00 committed by GitHub
parent 24a653f11d
commit 911a73abba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 27 deletions

1
changelog.d/506.misc Normal file
View File

@ -0,0 +1 @@
Refactor the Vite component's `tsconfig.json` file to make it compatible with the TypeScript project settings & the TypeScript language server.

View File

@ -1,27 +0,0 @@
{
"include": ["web"],
"compilerOptions": {
"module": "commonjs",
"target": "es2019",
"moduleResolution": "node",
"jsx": "preserve",
"jsxFactory": "h",
"baseUrl": "./",
/* noEmit - Snowpack builds (emits) files, not tsc. */
"noEmit": true,
/* Additional Options */
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"importsNotUsedAsValues": "error",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"typeRoots": [
"web/typings"
]
},
}

23
web/tsconfig.json Normal file
View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2019",
"moduleResolution": "node",
"jsx": "preserve",
"jsxFactory": "h",
/* noEmit - Snowpack builds (emits) files, not tsc. */
"noEmit": true,
/* Additional Options */
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"typeRoots": [
"./typings"
]
}
}

4
web/typings/images.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
declare module "*.png" {
const content: string
export = content
}