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

Conversation

daniellacosse
Copy link
Contributor

No description provided.

@daniellacosse daniellacosse requested a review from a team as a code owner January 12, 2023 20:36
"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

tsconfig.json Outdated
"skipLibCheck": true
"skipLibCheck": true,
"downlevelIteration": true,
"target": "es5"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

2017 is way too modern a target, as Android 5 was released in 2014. I've added downlevelIteration to support this (this allows support for compiling Iterators to this target)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we specify the target in the webpack, no?

es5 seems scary, and unnecessary for Electron.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mm, on second look we do have a BABEL_LOADER which uses @babel/preset-env which ascends up to the system root, looking for the browserlist. So it's there, but not very explicit.

What if I were to set the target here to "esnext" instead and add a comment pointing to the babel config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ugh, these things should live in src/cordova and src/electron respectively. I'll remove the target change for now and we can clean this up later.

tsconfig.json Outdated Show resolved Hide resolved
// 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."

tsconfig.json Outdated
"skipLibCheck": true
"skipLibCheck": true,
"downlevelIteration": true,
"target": "es5"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we specify the target in the webpack, no?

es5 seems scary, and unnecessary for Electron.

"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

Copy link
Collaborator

@fortuna fortuna left a comment

Choose a reason for hiding this comment

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

Ah, I see it was already there. Yes, better to keep it there.

@daniellacosse daniellacosse changed the title fix: spurious typescript errors and too-modern target fix: spurious typescript errors Jan 13, 2023
@daniellacosse
Copy link
Contributor Author

Ah, I see it was already there. Yes, better to keep it there.

Yes, sorry I sorted the JSON keys alphabetically

@daniellacosse daniellacosse merged commit 6c85539 into master Jan 13, 2023
jyyi1 added a commit that referenced this pull request Feb 22, 2023
### Changelog

- fix: temporarily remove client feedback view: #1548 , #1569 
- fix: ssconf:// deeplinking on ios: #1524
- fix: spurious typescript errors: #1550
- feat(www): 🌐 support 11 more languages: #1566
- chore: ⏫ upgrade tun2socks library to v3.1.0: #1576
@daniellacosse daniellacosse deleted the daniellacosse/stop_typescript_complaints branch March 6, 2024 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants