-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
build: upgrade ts to 3.8 to use export type syntax #9122
Conversation
LGTM, we need to discuss with the team the impact this will have with Angular |
thanks @ashika01 to help on the prettier issue!!!! For context: Will find a way to resolve this conflict. |
LGTM, Angular 9+ supports TS 3.7+. |
nohoist solved the build issue 🎉 but looks some unit tests are failing |
|
It might be how we originally setup. But doesn't have to be the case, if anything we should find a way why it aint pulling the one from root level and make changes accordingly. That said, if thats a huge effort we can do it outside of this PR (as a separate item) |
Codecov Report
@@ Coverage Diff @@
## main #9122 +/- ##
=======================================
Coverage 78.07% 78.07%
=======================================
Files 250 250
Lines 18122 18122
Branches 3891 3891
=======================================
Hits 14148 14148
Misses 3844 3844
Partials 130 130
Continue to review full report at Codecov.
|
update:
To further verify it works, I have trigger a circle CI integ test on a separate branch (deploy/release job is excluded from the workflow) 4 integ tests are failing due to the ts syntax change introduced. Will look more into it. |
* This will be removed in future release when CLI and customers moves to recommeneded import styles. | ||
*/ | ||
export { | ||
graphqlOperation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why this file shows up on the diff, nothing should be changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is strange but can we update the copyright date :)
@hkjpotato can we double check old yo components as well if some customers are using them. May have some issues if the angular cli is around 7 |
Yep good call. Not sure if you can access these: https://app.circleci.com/pipelines/github/aws-amplify/amplify-js?branch=kj%2Fts38integ (A bunch of failure trials on angular, because the sample test is using ts3.7. The most recent one passes finally) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 🚢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, left a minor non-blocking comment
@@ -71,7 +73,7 @@ | |||
"jest-config": "24.8.0", | |||
"json-loader": "^0.5.7", | |||
"lerna": "^3.13.1", | |||
"prettier": "^1.19.0", | |||
"prettier": "^2.4.1", | |||
"pretty-quick": "^1.11.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update pretty-quick
along with prettier
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested its newer version but from the current version's peerDependencies, it works with prettier >=1.8.0, so I think it might be safer to keep it now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🌮 Couple small nits but Non-Blocking to merge. Great work KJ!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thanks @hkjpotato
Can you check @calebpollman and @sammartinez comments?
Co-authored-by: Sam Martinez <samlmar@amazon.com>
Thank you and I have checked the comments. Will discuss offline to see if we want to merge this with tomorrow's release. |
LGTM, thanks for the research @hkjpotato. |
This pull request has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Description of changes
Upgrade typescript from 3.7 to 3.8, so as to facilitate the upcoming esm bundle by esbuild, BUT it is backward compatible to current version using version selection. Its backward compatibility has been tested by running through all integ tests, it works in IDE like vscode as well.
Before TS3.8, "type" and "value" can be exported together implicitly.
The mixing of type and value creates confusion for both human and machine, especially for build tool like ESBuild/Vite, which relies on TS compiler to work in "isolatedModules" mode.
After TS3.8, we can define the import/export more explicitly.
See detailed from typescript announcement https://devblogs.microsoft.com/typescript/announcing-typescript-3-8/#type-only-imports-exports, See similar issue related to esbuild support: evanw/esbuild#1398.
Related changes due to this upgrade:
typesVersions
to support backward compatibility: the only file changed is the index.d.ts for API, thus we redirects it to a separate file when customer is using a version < 3.8. This change has been tested by integ tests. The syntax follows the TS doc suggestion.tsconfig
of analytics category is removed to use the centralized one, similar to other package. This can help unblock the esbuild project as well.Support TypeScript 3.8 prettier/prettier#7263
Please note:
api/index.ts
where esBuild cannot infer the "type".scripts/build.js
.amazon-cognito-identity-js
, which still relies on babel to transpile, and will be addressed separately.Issue #, if available
Vite team @sodatea has pointed out a related issue for reference evanw/esbuild#1525
Description of how you validated changes
This change has been verified by hosting ESM at localhost, based on @elorzafe's origin POC. The localhost modules can be used by ESM syntax directly in browser.
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.