fix(types): incorrect <void> use in typescript#1608
fix(types): incorrect <void> use in typescript#1608nickhudkins wants to merge 1 commit intofacebook:mainfrom
Conversation
9ef4d4b to
c0cfb70
Compare
|
Thanks @nickhudkins! Several Metro packages do now have automatic TS types, but there are a few patterns unsupported by the translator and/or TS itself so we've been refactoring and touching up package-by-package to get translations working (any PRs to get us closer would be appreciated as well!). https://github.com/facebook/metro/blob/main/scripts/generateTypeScriptDefinitions.js#L29 |
|
I actually saw this and began down the path of doing type generation for metro, let me see if I can take an incremental approach here! |
|
Alrighty... |
Summary: As I began working to hand-fix some types, the formidable robhogan [pointed me](#1608 (comment)) in the direction of `generateTypeScriptDefinitions.js`, which has been used here to generate types for `metro-transform-worker` Changelog: [Internal]: Auto generate types for `metro-transform-worker` Pull Request resolved: #1610 Test Plan: Automatically tested in CI, also peformed a good-ol eyeball check. Reviewed By: motiz88, robhogan Differential Revision: D86662805 Pulled By: vzaidman fbshipit-source-id: 2e8cc43863b5285976a0759e0c1881b202e1aebc
…k#1610) Summary: As I began working to hand-fix some types, the formidable robhogan [pointed me](facebook#1608 (comment)) in the direction of `generateTypeScriptDefinitions.js`, which has been used here to generate types for `metro-transform-worker` Changelog: [Internal]: Auto generate types for `metro-transform-worker` Pull Request resolved: facebook#1610 Test Plan: Automatically tested in CI, also peformed a good-ol eyeball check. Reviewed By: motiz88, robhogan Differential Revision: D86662805 Pulled By: vzaidman fbshipit-source-id: 2e8cc43863b5285976a0759e0c1881b202e1aebc
Summary: As I began working to hand-fix some types, the formidable robhogan [pointed me](#1608 (comment)) in the direction of `generateTypeScriptDefinitions.js`, which has been used here to generate types for `metro-file-map` Changelog: [Fix]: Auto generate types for `metro-file-map` Pull Request resolved: #1611 Test Plan: Automatically tested in CI, also peformed a good-ol eyeball check. Reviewed By: vzaidman Differential Revision: D90583383 Pulled By: robhogan fbshipit-source-id: 626c8fc63407b6d9aa7cb18993ad1096455bd202
Summary
The use of
voidas a type parameter is semantically different in TS than Flow. Specifically, providingvoidin Flow will result in the use of the default type parameter value, while TS will treat it as an explicit use ofvoidfor the generic.Original Issue: #1491
Changelog:
[Fix]
Bundlertypes (transformFile)[Fix]
IncrementalBundlertypes (OutputGraph,getDeltaBundler,getDependencies,buildGraph,initializeGraphandupdateGraph)[Fix]
Workertypes (transform)[Fix]
Metro.buildGraphreturn typeTest plan
Oof. This may be a larger discussion as keeping the TS and Flow types in-sync and correct may be a moving target as the project evolves. For now, the verification is "when consuming this code in a TS codebase, types are the same as if I was consuming the flow annotated code"