-
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
Framework: Resolve WordPress package type imports #18927
Conversation
Isn't this type defined in the |
Hm, that's a good observation. I wonder if TypeScript is traversing all of the dependency hierarchy, which could be problematic for what I propose in #18927 as being a "public API" of types. I mean, at worst it means we expose all types of a package, which I suppose is not too problematic, and it can make it easier to avoid needing to "re-export" all of these types from the entry point. The only worry I'd have is being clear that if a type is associated with a function which is otherwise not part of the public API, there should be no commitment to backwards-compatibility, whatever that might mean to have "backwards-compatibility of a type". |
@aduth Do you have the typescript definitions installed from definitelytyped? If so, it might also be coming from there. Your editor might automatically be fetching those definitions from definitelytyped even if the repo doesn't have them installed as well. |
I was seeing this in my earlier iterations of this branch, how the modules would resolve to a cached copy of the DefinitelyTyped types. I don't think that's what's happening here. I'd want to double-check, though. |
Co-Authored-By: Grzegorz (Greg) Ziółkowski <[email protected]>
Previously suggested by @dsifford at #18838 (comment)
This pull request seeks to add necessary configuration to resolve cross-package type imports.
In Progress: This may be problematic to implement until existing issues can be resolved, since an
import
of a type will subject the entire dependency hierarchy to types checking, even if the module is not part of theincludes
set in the configuration.Testing Instructions:
As an example, include a type reference to a file covered by types checking:
If you have an editor integration, you can observe that the type is resolved:
However, when running
npm run lint-types
, you will also see ~26 new errors introduced through the analyzed result of the@wordpress/element
dependency hierarchy.