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

Export TypeScript Declarations in New Syntax #139

Merged
merged 44 commits into from
Sep 29, 2022

Conversation

NeilKleistGao
Copy link
Member

@NeilKleistGao NeilKleistGao commented Sep 14, 2022

related issue: #134
also:

  • Add namespace keyword
  • Add some types in toType_!
  • Add comments parsing
  • Fix nested type arguments
  • Add inner class translation
  • Add constructor translation
  • Add type parameters for functions
  • Use parameter names in TS

Copy link
Contributor

@LPTK LPTK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

shared/src/main/scala/mlscript/NewParser.scala Outdated Show resolved Hide resolved
shared/src/main/scala/mlscript/JSBackend.scala Outdated Show resolved Hide resolved
shared/src/main/scala/mlscript/codegen/Scope.scala Outdated Show resolved Hide resolved
ts2mls/js/src/main/scala/ts2mls/types/Converter.scala Outdated Show resolved Hide resolved
ts2mls/js/src/test/diff/Array.d.mls Show resolved Hide resolved
@LPTK
Copy link
Contributor

LPTK commented Sep 14, 2022

Also, def f: T in the old parser corresponds to fun f: T in the new one. Functions in TS should generate that.

@NeilKleistGao
Copy link
Member Author

NeilKleistGao commented Sep 16, 2022

I also wonder if fun add(_: number, _: number): number is acceptable. Or fun add(x: number, y: number): number, where x and y are original names from TypeScript codes, is better?

And what about fun add(v0: number, v1: number): number?

@LPTK
Copy link
Contributor

LPTK commented Sep 19, 2022

Doesn't fun add(_: number, _: number): number currently work?

@NeilKleistGao
Copy link
Member Author

So far, it works. But I guess a form like fun add(v0: number, v1: number): number is better?

@LPTK
Copy link
Contributor

LPTK commented Sep 19, 2022

I don't understand the question. Why not just reuse the names from TS?

@NeilKleistGao
Copy link
Member Author

I don't understand the question. Why not just reuse the names from TS?

ok! I will.

@NeilKleistGao NeilKleistGao marked this pull request as ready for review September 21, 2022 07:55
@NeilKleistGao NeilKleistGao requested a review from LPTK September 21, 2022 09:05
@LPTK
Copy link
Contributor

LPTK commented Sep 26, 2022

Oh no... I didn't realized >> was going to be misparsed! Like C++ in the old days 🤦‍♂️

I guess your solution is good enough for now...

Copy link
Contributor

@LPTK LPTK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! Seems like this can be merged now. You can go ahead and squash-merge it with a clean commit message.

@LPTK LPTK changed the title Export TypeScript Declarations in New Grammars Export TypeScript Declarations in New Syntax Sep 29, 2022
@LPTK LPTK merged commit 61f963d into hkust-taco:mlscript Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants