nytimes / kyt

Starting a new JS app? Build, test and run advanced apps with kyt 🔥
https://open.nytimes.com/introducing-kyt-our-web-app-configuration-toolkit-9ccddf6f6988
Other
1.92k stars 108 forks source link

fix(babel-preset-kyt): ensure that @babel/preset-typescript is the last preset in the array #1142

Closed kohlmannj closed 1 year ago

kohlmannj commented 1 year ago

relates to #1135 blocks nytimes/news#5565

Description

This PR updates babel-preset-kyt to ensure that @babel/preset-typescript appears last in the presets array, and thus, is applied first (docs).

This fixes an issue in which Babel could fail to transpile certain TypeScript syntax, such as the TypeScript “constructor shorthand” syntax, when using babel-preset-kyt v1.1.20.

How to Review

  1. Check out nytimes/babel-hell-2k23
  2. Install or yarn link a pre-release version of babel-preset-kyt created from the contents of this PR
  3. Verify that running yarn test exits without an error ("The resulting code appears to be OK:")
kohlmannj commented 1 year ago

Happened to catch this tip re: presets ordering from the unofficial babel-preset-proposal-typescript project, by the way.