Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Map RequestOptions in flow to RequestInit in TypeScript for fetch API #261

Open
Pike opened this issue Mar 17, 2021 · 4 comments
Open

Map RequestOptions in flow to RequestInit in TypeScript for fetch API #261

Pike opened this issue Mar 17, 2021 · 4 comments

Comments

@Pike
Copy link

Pike commented Mar 17, 2021

The optional second parameter in the fetch API has a mismatching type name in flow and ts, it'd be great if that could be translated.

https://github.com/facebook/flow/blob/a597d6df9bc221130f68437389a4d26d82e3726d/lib/bom.js#L1543

vs

https://github.com/microsoft/TypeScript/blob/ec77bff33226fb01f4e38b20e481f8c1fcd9e6c0/lib/lib.dom.d.ts#L18739

@Pike
Copy link
Author

Pike commented Mar 17, 2021

Maybe more importantly, also CredentialsType to RequestCredentials

@kevinbarabash
Copy link
Contributor

kevinbarabash commented Mar 17, 2021

Just to confirm:

RequestOptions -> RequestInit
CredentialsType -> RequestCredentials

I think I might add a way to provide these mappings via a config file as well that way people don't need to wait on changes to the tool itself.

@Pike
Copy link
Author

Pike commented Mar 17, 2021

Confirmed, and I like the idea of having a config file to map types, too.

Background, we're preparing mozilla/pontoon to be converted from flow to typescript, and run flow-to-ts in a github workflow, https://github.com/mozilla/pontoon/actions/workflows/frontend.yml?query=branch%3Amaster. The idea is that we'll be able to do the actual conversion with a minimal impact on the normal development. Having a config in-tree for type renames is going to be really helpful.

@kevinbarabash
Copy link
Contributor

That's super cool! I hadn't thought about running it as a GitHub action. Thanks for sharing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants