-
Notifications
You must be signed in to change notification settings - Fork 623
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: Improve type safety for browser-compatible modules #995
Conversation
for revealing type issues
I think we need to add a new step in something like:
|
@kt3k This makes sense. Have any ideas on how to programmatically generate the list of matching modules and insert into the workflow file so that manual maintenance is not needed? |
@jsejcksn I guess something like the below might work grep "This module is browser compatible" . -Rl | xargs deno cache --config browser-compat.tsconfig.json |
exclude ./.gihub dir (Ref: https://stackoverflow.com/a/6565519)
@kt3k I tried adding a step for type checking, but got an error like this:
At first, I thought it was because the YAML file was matching, too, but even after applying a variation to ignore the Feel free to make a code change suggestion or add a commit to this PR if you think you can make it work. This was my last addition before reverting: - name: Type check browser compatible modules
run: grep -Rl --exclude-dir=./.github "// This module is browser compatible." . | xargs deno cache --config browser-compat.tsconfig.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsejcksn Thank you for your contribution! LGTM
@kt3k Thanks for fixing the workflow file |
This PR fixes the current compiler errors emitted when using browser-compatible TypeScript modules without including the Deno namespace library in
compilerOptions.lib
.There is a link to contributing guidelines toward the end of the Deno repo README, which includes this:
This statement is not explicit about type compatibility, but I think it is natural for the type safety of browser-compatible modules to be aligned in the same way.
I searched for all files including the mentioned text using this method:
For each file, I checked the diagnostic output of the compiler for warnings/errors using a browser-compatible TSConfig with Deno. (The TSConfig is presently included in the PR, but can be removed if desired.) If diagnostic messages were emitted for a file, I addressed them in the source. Most of the changes involve modifications to conditional expressions used to determine whether or not a Deno method or property exists.