Shopify / quilt

[⚠️ Deprecated] A loosely related set of packages for JavaScript/TypeScript projects at Shopify
MIT License
1.7k stars 221 forks source link

Add missing compilerOptions.lib necessary for tsd-lite to test types consistently #2838

Closed jesstelford closed 2 months ago

jesstelford commented 2 months ago

Under some circumstances, tsd-lite will throw errors while testing such as:

❯ yarn run jest packages/useful-types/test-d/types.test-d.ts
 FAIL   useful-types  packages/useful-types/test-d/types.test-d.ts
  ✕ tsd typecheck (2562 ms)

  ● tsd typecheck

    Cannot find name 'WeakMap'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.

    > 29 |   seenReferences?: WeakMap<object, boolean>,
         |                    ^

      at node_modules/.pnpm/@jest+expect-utils@29.7.0/node_modules/@jest/expect-utils/build/index.d.ts:29:20

I think it has to do with which version of a transitive dependency is installed.

Either way; the compilerOptions.lib option fixes it, and it should have always been there. This PR adds it.

NOTE: I skipped changelog as this is a purely internal test thing only and doesn't require a release.