From 911a73abba4be5eb33f6c1a47f02eef06d1b7bf8 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Fri, 30 Sep 2022 12:35:53 -0400 Subject: [PATCH] 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. --- changelog.d/506.misc | 1 + tsconfig.web.json | 27 --------------------------- web/tsconfig.json | 23 +++++++++++++++++++++++ web/typings/images.d.ts | 4 ++++ 4 files changed, 28 insertions(+), 27 deletions(-) create mode 100644 changelog.d/506.misc delete mode 100644 tsconfig.web.json create mode 100644 web/tsconfig.json create mode 100644 web/typings/images.d.ts diff --git a/changelog.d/506.misc b/changelog.d/506.misc new file mode 100644 index 00000000..c370fd3b --- /dev/null +++ b/changelog.d/506.misc @@ -0,0 +1 @@ +Refactor the Vite component's `tsconfig.json` file to make it compatible with the TypeScript project settings & the TypeScript language server. diff --git a/tsconfig.web.json b/tsconfig.web.json deleted file mode 100644 index e9bfaa91..00000000 --- a/tsconfig.web.json +++ /dev/null @@ -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" - ] - }, - } - \ No newline at end of file diff --git a/web/tsconfig.json b/web/tsconfig.json new file mode 100644 index 00000000..99fcd5d2 --- /dev/null +++ b/web/tsconfig.json @@ -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" + ] + } +} diff --git a/web/typings/images.d.ts b/web/typings/images.d.ts new file mode 100644 index 00000000..476fa54d --- /dev/null +++ b/web/typings/images.d.ts @@ -0,0 +1,4 @@ +declare module "*.png" { + const content: string + export = content +} \ No newline at end of file