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

TS 4.9 compat #587

Merged
merged 5 commits into from Nov 4, 2022
Merged

TS 4.9 compat #587

merged 5 commits into from Nov 4, 2022

Commits on Nov 3, 2022

  1. Configuration menu
    Copy the full SHA
    e5d99b9 View commit details
    Browse the repository at this point in the history
  2. Bump Prettier and RTK

    markerikson committed Nov 3, 2022
    Configuration menu
    Copy the full SHA
    69a4ff4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f57ef85 View commit details
    Browse the repository at this point in the history
  4. Bump TS to 4.8

    markerikson committed Nov 3, 2022
    Configuration menu
    Copy the full SHA
    5b83d04 View commit details
    Browse the repository at this point in the history
  5. Rewrite MergeParameters to work with TS 4.9

    Per microsoft/TypeScript#50831 , the existing
    implementation of `MergeParameters` broke with TS 49 due to a change
    in how "optional" and "undefined" arguments get interpreted
    
    Anders Hjelsberg himself supplied a new implementation that's actually
    much simpler, but only works with TS 4.7 and greater.
    
    Normally this would require shipping two entirely different sets of
    types, as we already do for TS <4.1. However, there's a trick we used
    with RTK where we:
    
    - Create a folder and put two different files with different impls of
      the same type inside
    - Add an index file and re-export one of those
    - Add a file named `package.dist.json` containing `typesVersions` that
      points to both of those `.d.ts` files
    - Copy that `package.dist.json` over to `dist/some/package.json` during
      the actual build/publish step
    
    That way during dev TS just imports the type as normal, but the built
    version sees that `some/package.json`, sees `typesVersions`, finds the
    right `.d.ts` file, and imports the right implementation for itself.
    markerikson committed Nov 3, 2022
    Configuration menu
    Copy the full SHA
    11ed107 View commit details
    Browse the repository at this point in the history