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

WIP: Explore typing on core data packages #35869

Draft
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Draft

Conversation

dmsnell
Copy link
Member

@dmsnell dmsnell commented Oct 22, 2021

How much can we get from core data types?

I like getting stuff for "free" (in the screenie we rename the file to .ts and the store auto-infers, something we could plausibly do for all the core packages)

freeTypes mov

This is a playground-PR related to #34190

Notes

  • Something seems circular in packages/data/src/types.d.ts. It might help to create separate TS files but I need to figure out how this impacts the generated types in the project. Specifically WPDataStore and WPDataRegistry seem circular in a logical way.
  • Drastic things change when we rename a file to .ts and this impacts module resolution. I have TypeScript working but my IDE shows an error, unable to resolve module. I would love for this resolution to work without having to stub out a tsconfig.json file in every package that references other packages and will need to check if this is already "resolved" in other packages.

@dmsnell dmsnell force-pushed the dmsnell/data-typing branch from ada10d4 to 1222a37 Compare October 22, 2021 18:31
@gziolo gziolo added the [Type] Code Quality Issues or PRs that relate to code quality label Oct 24, 2021
dmsnell added a commit that referenced this pull request Oct 28, 2021
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.
@dmsnell dmsnell force-pushed the dmsnell/data-typing branch from 13d1e88 to e2022a7 Compare October 29, 2021 00:14
dmsnell added a commit that referenced this pull request Oct 29, 2021
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants