Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/typescript-configs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

<!-- ## Unreleased -->
## Unreleased

### Breaking Change

Increased the target and lib definitions to es2020 in both `base.json` and `dom.json`. This allows for a greater range of standard features to be defined and used. We expect typescript will be ran through Babel to downlevel/polyfill all features required for your target environment [[#239](https://github.com/Shopify/web-configs/pull/239)]
Copy link
Copy Markdown
Contributor

@kaelig kaelig Apr 24, 2021

Choose a reason for hiding this comment

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

💅

Suggested change
Increased the target and lib definitions to es2020 in both `base.json` and `dom.json`. This allows for a greater range of standard features to be defined and used. We expect typescript will be ran through Babel to downlevel/polyfill all features required for your target environment [[#239](https://github.com/Shopify/web-configs/pull/239)]
Increased the target and lib definitions to es2020 in both `base.json` and `dom.json`. This allows for a greater range of standard features to be defined and used. We expect TypeScript will be ran through Babel to downlevel/polyfill all features required for your target environment [[#239](https://github.com/Shopify/web-configs/pull/239)]


## 4.0.0 - 2021-02-24

Expand Down
2 changes: 1 addition & 1 deletion packages/typescript-configs/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"esModuleInterop": true,
"isolatedModules": true,
"experimentalDecorators": true,
"lib": ["dom", "es2018", "esnext.asynciterable"],
"lib": ["dom", "es2020"],
"moduleResolution": "node",
"noUnusedLocals": true,
"noUnusedParameters": true,
Expand Down
7 changes: 3 additions & 4 deletions packages/typescript-configs/dom.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
"lib": [
"dom",
"dom.iterable",
"es2017",
"esnext.asynciterable",
"scripthost"
"scripthost",
"es2020"
],
"module": "esnext",
"target": "es2017"
"target": "es2020"
Copy link
Copy Markdown
Contributor

@kaelig kaelig Apr 24, 2021

Choose a reason for hiding this comment

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

ES2017 is still the best compilation target for modern browsers (supported by 95% of user agents), as it can be served without further transpiling using <script module src="..."></script>.
Then, apps who really want to support the additional 5% of browsers can transpile that first target into ES5, and serve it using <script nomodule src="..."></script>.

What I'm trying to say is that by keeping the target to ES2017, we're removing the need for a transpiler such as babel in most cases.

What am I missing here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We don't want tsc as part of our build chain, babel (or in a potential future esbuild) for single file transpilation is much better suited to our needs as they allow finer grained transpiling based on browser (/node) support of single features rather than whole standard versions.

Ideally tsc should only be used for type-checking, and we use something else to to builds. Thus this target doesn't really do anything, I'm just setting it here to match the lib value.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you, that makes sense!

},
"files": ["./definitions/images.d.ts", "./definitions/styles.d.ts"]
}