Skip to content

Conversation

@Pike
Copy link
Collaborator

@Pike Pike commented Mar 18, 2021

Very WIP.

Practically, I'm down to 2 flow errors, and passing tests.

Theoretically, I'm doing typing quite a bit different than it's done on the typescript side.

I remember conversations with @stasm about the use of base classes for Expressions etc and their incompleteness. Which I've done the other way around now so that refinements work.

@Pike Pike closed this Apr 1, 2021
@Pike Pike reopened this Apr 1, 2021
@Pike Pike force-pushed the fluent-def branch 6 times, most recently from b756e34 to 005c66a Compare April 9, 2021 16:35
@Pike Pike marked this pull request as ready for review April 9, 2021 16:43
Copy link
Collaborator Author

@Pike Pike left a comment

Choose a reason for hiding this comment

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

This is ready for review. I left an inline comment on core/utils/fluent/types.js with an open question.

The tests expect and if not pattern is because neither flow nor typescript narrow types on failed test assertions. Thus I went for test-and-return instead.

@Pike Pike requested a review from abowler2 April 22, 2021 16:13
@Pike Pike requested a review from abowler2 May 5, 2021 12:36
@Pike Pike removed the request for review from abowler2 May 6, 2021 16:08
@Pike Pike force-pushed the fluent-def branch 3 times, most recently from f3e9a60 to 1ee9083 Compare May 6, 2021 22:35
@Pike Pike requested a review from abowler2 May 6, 2021 22:40
@Pike
Copy link
Collaborator Author

Pike commented May 6, 2021

Addressed the comments and discussions, TS errors are going from 137 to 105 now that we don't convert tests.

There's one in-test fix about the mocked bundles, which is one of those cases where having type checks avoids having junk in tests. Just adding that as a data point, I don't think this puts a dent in our decision to leave the tests in JavaScript.

activeTranslationString || entity.original,
);

if (syntax === '') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are these checks no longer needed? (there is the same check line#208)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

getSyntaxType never returns an empty string, it's always one of the SyntaxType enum.

This condition will always return 'false' since the types 'SyntaxType' and '""' have no overlap.

is what https://github.com/mozilla/pontoon/runs/2520885795?check_suite_focus=true#step:16:782 says on master right now.

@Pike Pike added the typescript PRs related to the conversion to TypeScript label May 7, 2021
@Pike Pike changed the title Type @fluent/syntax Bug 1685565: Type @fluent/syntax May 7, 2021
@Pike Pike requested a review from abowler2 May 7, 2021 20:47
@mathjazz mathjazz self-requested a review May 8, 2021 07:18
@mathjazz
Copy link
Collaborator

mathjazz commented May 8, 2021

Flagging myself for review here to take it through my standard manual editor testing process.

@mathjazz mathjazz self-requested a review May 8, 2021 17:26
Copy link
Collaborator

@mathjazz mathjazz left a comment

Choose a reason for hiding this comment

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

I haven't spot any issues.

The code also looks good to my newbie TS self.

@abowler2 Did you want to have another look here?

@abowler2
Copy link
Collaborator

abowler2 commented May 9, 2021

@Pike and @mathjazz

Took another look and all looks good to me on this one.

@mathjazz mathjazz merged commit 410fc19 into mozilla:master May 9, 2021
@Pike Pike deleted the fluent-def branch May 10, 2021 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

typescript PRs related to the conversion to TypeScript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants