-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[data]: Rename types file from .d.ts to .ts #36062
Conversation
While working on #35869 I discovered that the module where we keep some top-level type definitions is named with the `.d.ts` suffix as if it were a manually-maintained types definition file. It's capable of being a normal TypeScript module though, and my IDE was having a bit of trouble with the `.d.ts` suffix - not because that was wrong, but I think because it was different than what the IDE expected. In this patch all we're doing is renaming the file in order to smooth this over and clean up later type-related patches that will occur to the data package. Updating `tsconfig.json` was necessary becuase of the rename so that TypeScript will appropriately find and use these types.
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.
This makes sense, thanks 👍
@@ -17,5 +17,6 @@ | |||
"src/redux-store/metadata/**/*", | |||
"src/promise-middleware.js", | |||
"src/utils", | |||
"src/*.ts" |
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.
This could probably be src/**/*.ts
, I expect TypeScript files anywhere are expected to be included 🙂
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.
I'll update that when I actually start using .ts
files in there. How does that sound?
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.
LGTM
I've rebuilt the project and it appears like the generated |
Description
While working on #35869 I discovered that the module where we keep some
top-level type definitions is named with the
.d.ts
suffix as if itwere a manually-maintained types definition file.
It's capable of being a normal TypeScript module though, and my IDE was
having a bit of trouble with the
.d.ts
suffix - not because that waswrong, but I think because it was different than what the IDE expected.
In this patch all we're doing is renaming the file in order to smooth
this over and clean up later type-related patches that will occur to
the data package. Updating
tsconfig.json
was necessary becuase of therename so that TypeScript will appropriately find and use these types.
How has this been tested?
There should be no change in the bundled JavaScript code. There should be
no functional or visual changes.
❓ Could this impact any third-party projects dependent on
@wordpress/data
?We need to verify that this generates the same type definitions for the package
as it previously did.
Types of changes
Renaming a module holding type definitions.
Checklist:
*.native.js
files for terms that need renaming or removal).