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

[Bug] patched typescript does not respect typesVersions #2223

Closed
1 task done
cspotcode opened this issue Dec 8, 2020 · 1 comment · Fixed by #2440
Closed
1 task done

[Bug] patched typescript does not respect typesVersions #2223

cspotcode opened this issue Dec 8, 2020 · 1 comment · Fixed by #2440
Labels
bug Something isn't working reproducible This issue can be successfully reproduced

Comments

@cspotcode
Copy link

  • I'd be willing to implement a fix

Describe the bug

Specifically when importing a sub-path of a package, it seems that yarn 2's TSC patch is not respecting typesVersions.

For example, importing @jest/types/build/Config should be remapped to @jest/types/build/ts3.4/Config https://unpkg.com/@jest/[email protected]/package.json (for v25)

Fixed by:
arcanis/TypeScript#5
#2215

To Reproduce

Reproduction
const {promises: {writeFile}} = require(`fs`);

await packageJsonAndInstall({
devDependencies: {
  [`@types/node`]: `latest`,
  [`@jest/types`]: `25`,
  [`typescript`]: `3.7.5`
}
});

await writeFile(`index.ts`, `
export {};
`);
await expect(yarn(`tsc`, `index.ts`)).resolves.toBe('');

await writeFile(`index.ts`, `
import * as Config from "@jest/types/build/Config";
`);
await expect(yarn(`tsc`, `index.ts`)).resolves.toBe('');

Screenshots

If applicable, add screenshots to help explain your problem.

Environment if relevant (please complete the following information):

  • OS: [e.g. OSX, Linux, Windows, ...]
  • Node version [e.g. 8.15.0, 10.15.1, ...]
  • Yarn version [e.g. 2.0.0-rc1, ...]

Additional context

Add any other context about the problem here.

@cspotcode cspotcode added the bug Something isn't working label Dec 8, 2020
@yarnbot
Copy link
Collaborator

yarnbot commented Dec 8, 2020

This issue reproduces on master:

Error: expect(received).resolves.toBe()

Received promise rejected instead of resolved
Rejected to value: [Error: Command failed: /usr/bin/node /github/workspace/scripts/actions/../run-yarn.js tsc index.ts

.yarn/cache/@jest-types-npm-25.5.0-45f0640591-33ad68320e.zip/node_modules/@jest/types/build/Config.d.ts(8,13): error TS1005: '=' expected.
.yarn/cache/@jest-types-npm-25.5.0-45f0640591-33ad68320e.zip/node_modules/@jest/types/build/Config.d.ts(8,32): error TS1005: ';' expected.
.yarn/cache/@jest-types-npm-25.5.0-45f0640591-33ad68320e.zip/node_modules/@jest/types/build/Config.d.ts(9,13): error TS1005: '=' expected.
.yarn/cache/@jest-types-npm-25.5.0-45f0640591-33ad68320e.zip/node_modules/@jest/types/build/Config.d.ts(9,36): error TS1005: ';' expected.
]
    at expect (/github/workspace/.yarn/cache/expect-npm-24.8.0-8c7640c562-0ac41999f0.zip/node_modules/expect/build/index.js:138:15)
    at module.exports (evalmachine.<anonymous>:20:7)
    at async /github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:56:13
    at async executeInTempDirectory (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:17:16)
    at async Object.executeRepro (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:24:12)
    at async ExecCommand.execute (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/commands/exec.js:25:38)
    at async ExecCommand.validateAndExecute (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Command.js:161:26)
    at async Cli.run (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Cli.js:74:24)
    at async Cli.runExit (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Cli.js:83:28)

@yarnbot yarnbot added the reproducible This issue can be successfully reproduced label Dec 8, 2020
@merceyz merceyz mentioned this issue Feb 5, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reproducible This issue can be successfully reproduced
Projects
None yet
2 participants