Skip to content

Narrow TypeScript spec exclusions to spec directory#10003

Merged
aduth merged 1 commit intomainfrom
aduth-typecheck-exclude-only-spec
Jan 30, 2024
Merged

Narrow TypeScript spec exclusions to spec directory#10003
aduth merged 1 commit intomainfrom
aduth-typecheck-exclude-only-spec

Conversation

@aduth
Copy link
Contributor

@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
* ```
*
* @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
Contributor 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
@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