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

Narrow TypeScript spec exclusions to spec directory #10003

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

aduth
Copy link
Member

@aduth aduth commented Jan 30, 2024

🛠 Summary of changes

Limits TypeScript exclusions for spec files to those in the spec/ directory.

Why?

  • Moves in the direction of full type-checking coverage
  • Recent conventions prefer adding spec files in app/javascript, so...
    • ... spec/ files should be considered "legacy"
    • ... we want to enforce full type checking coverage for new spec files in app/javascript
  • Helps identify legitimate issues (e.g. see included changes)

📜 Testing Plan

Verify that TypeScript type-checking passes:

yarn typecheck

changelog: Internal, Type Checking, Increase type checking code coverage
@@ -27,7 +27,7 @@ const ExtractKeysWebpackPlugin = require('./extract-keys-webpack-plugin.js');
* // 'foo'
* ```
*
* @param {Record<string, any>} object
* @param {undefined|Record<string, any>} object
Copy link
Contributor

Choose a reason for hiding this comment

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

does marking it as optional like this work here?

Suggested change
* @param {undefined|Record<string, any>} object
* @param {Record<string, any>=} object

Copy link
Member Author

Choose a reason for hiding this comment

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

It looks like TypeScript would treat that as an optional parameter and then get mad about a required parameter following an optional parameter.

app/javascript/packages/rails-i18n-webpack-plugin/rails-i18n-webpack-plugin.js:35:22 - error TS1016: A required parameter cannot follow an optional parameter.

35 function dig(object, keyPath) {
                        ~~~~~~~

@aduth aduth merged commit 0b6e886 into main Jan 30, 2024
2 checks passed
@aduth aduth deleted the aduth-typecheck-exclude-only-spec branch January 30, 2024 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants