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

Add static types #93

Open
s-yadav opened this issue Sep 8, 2020 · 0 comments
Open

Add static types #93

s-yadav opened this issue Sep 8, 2020 · 0 comments
Assignees
Labels
RFC Request For Comments

Comments

@s-yadav
Copy link
Collaborator

s-yadav commented Sep 8, 2020

Just writing down my thought process for reference.

Testing Typescript and Flow type both for adding types in Brahmos.

Currently, Brahmos support typescript but only with Babel ecosystem, the main reason behind that we current have babel plugin to transform JSX into tagged template literals.

Current for support of typescript the babel config looks like this:

module.exports = {
  presets: [['@babel/preset-env']],
  plugins: [
    ['@babel/plugin-transform-typescript', { isTSX: true, onlyRemoveTypeImports: true }],
    'brahmos',
    // ...
  ],
};

Plus React type definition (flowtypes / typescript) can be used alongside with Brahmos, as the API for both is same, though you have to point to React types plus you will see React in name rather than Brahmos. Which should be okay for start, until Brahmos publishes it own type definition.

Now coming back to a decision on building Brahmos lib itself with typescript or flow types for static typing.

With typescript the problem is

  • Brahmos doesn't natively support typescript, but only with babel ecosystem. If Brahmos itself is built with typescript it may raise confusion that it supports typescript natively.
  • All file name need to be changed to .ts or .tsx .

As currently, the requirement of typescript is just for defining the static type, I am inclining toward flowtype for the statically typing the Brahmos.

I personally don't see a lot of benefit of using typescript right away. But I would keep this discussion open to learn more if typescript is proving better given only the static typing use case.

@s-yadav s-yadav added the RFC Request For Comments label Sep 8, 2020
@s-yadav s-yadav self-assigned this Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Request For Comments
Projects
None yet
Development

No branches or pull requests

1 participant