Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: spurious typescript errors #1550

Merged
merged 4 commits into from
Jan 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 12 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
{
"compilerOptions": {
"target": "es2017",
"allowJs": true,
"baseUrl": "./",
"esModuleInterop": true,
"experimentalDecorators": true,
"removeComments": false,
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"noImplicitThis": true,
"moduleResolution": "node",
"module": "commonjs",
"outDir": "build",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the reason why we were seeing so many errors in the vscode intellisense - we needed a default output directory so ts wasn't trying to override our javascript files with themselves

"removeComments": false,
"resolveJsonModule": true,
"esModuleInterop": true,
"allowJs": true,
"skipLibCheck": true
"rootDir": "./",
"skipLibCheck": true,
"target": "es2017"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to specify a target? Will this affect the build or just VSCode?
If it doesn't affect the build, then esnext seems more appropriate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it seems the es2017 target here is specifically for electron, as we're not using babel in the electron webpack. I'm afraid if I remove or change it, it may break electron. This is way too ambiguous - the needed JS build target and build parameters for electron should live directly in src/electron. I started working on this a while back (#1459) so I think that's the next step here

},
// We don't need TypeScript to check javascript files.
"include": ["./src/**/*.ts"],
"exclude": ["node_modules", "www", "./src/**/*.js", "./src/**/*.mjs", "./www/**/*", "./build/**/*"]
"exclude": ["*.cjs", "*.js", "*.mjs"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we exclude node_modules?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have an include for src, which scopes all our compilation to src - node_modules is outside of src:

https://www.typescriptlang.org/tsconfig#include
https://www.typescriptlang.org/tsconfig#exclude

"Exclude: Specifies an array of filenames or patterns that should be skipped when resolving include."

"include": ["src"]
}