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

Respect package.json "type" and module-format-specific file extensions in more module modes #57896

Merged

Conversation

andrewbranch
Copy link
Member

@andrewbranch andrewbranch commented Mar 21, 2024

Fixes #54752
Fixes #50647
Closes #54788
Related #55221
Prerequisite for #54102

Suggest reviewing individual commits:

  • 96bffce: source changes
  • 09330b8: tests showing new behavior
  • c89137d: noise due to always looking up package.json
  • 11e5727: noise due to the same, plus impliedNodeFormat always existing in buildinfo
  • f9f46fd: less noisy changes to existing test behavior, worth reviewing

This PR allows us to use module-format-specific file extensions and package.json "type" fields in all module modes—not just in node16/nodenext as today—but the way we use them can vary by module/moduleResolution mode. This has two noticeable effects:

  1. Emit respects file extension / package.json "type" more often.

    • When module is es2015esnext, we will now treat .cts/.cjs files, as well as .ts/.js files when the nearest package.json has "type": "commonjs", as CommonJS and emit CommonJS outputs accordingly. Note that unlike in --module nodenext, a lack of package.json "type" does not cause .ts/.js files to be treated as CommonJS. We only override the default behavior of the module setting when "type" is explicitly set to "commonjs", or when the file extension is .cts/.cjs.
    • When module is commonjs, we will now treat .mts/.mjs files, as well as .ts/.js files when the nearest package.json has "type": "module", as ESM and output ESM outputs accordingly.
    • When module is preserve, ESM import/export declarations are now forbidden in .cts/.cjs files, as well as in .ts/.js files when the nearest package.json has "type": "commonjs". We want to ensure that --module preserve means the module syntax you write gets emitted without significant transformation, but we also want to prevent ESM syntax from being used in unambiguously CommonJS files, so this situation acts much like verbatimModuleSyntax is enabled.
  2. Unambiguously ESM-mode declaration files do not get synthesized default exports

    • This is ESM-only packages come with synthesized default in moduleResolution: bundler #54752. Now that we always collect information about the package.json "type" and file extension, we gain the ability to notice when a declaration file, likely in a node_modules dependency, must represent an ESM JavaScript file, which changes how a default import targeting that file works. Previously, under all module modes except node16/nodenext, this was allowed:

      // @Filename: node_modules/esm-dep/foo.d.mts
      export declare const x: any;
      
      // @Filename: index.ts
      import esm from "esm-dep/foo.mjs";
      esm.x;

      Since foo.d.mts has an unambiguously-ESM file extension, we should not allow a default import from a module that doesn’t declare a default export. However, it was allowed because we believed that foo.d.mts might actually represent a CommonJS module with a module.exports.x property, in which case a default import should be allowed and would link to the module.exports object. With this PR, when a declaration file has an ESM file extension or exists in a "type": "module" context, we use that to prevent us from letting a default import happen where it shouldn’t.

This work also unlocks a fix for #54102. Webpack and esbuild use module-format-specific file extensions and package.json "type" to vary their ESM/CJS interop rules, so if we want to provide correct types for projects using those bundlers, we will need to be able to leverage that module format info under --module esnext or --module preserve.

There is one test failing that represents an pre-existing bug that was not exposed until now because the test did not previously look up package.json files, and a particular sequence of edits causes a failure in combination with that. It has been isolated to a failure that doesn’t rely on this PR’s changes in #57757 so it can be investigated separately.

@typescript-bot
Copy link
Collaborator

Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page.

Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up.

@andrewbranch andrewbranch changed the title Always set implied node format Respect package.json "type" and module-format-specific file extensions in more module modes Mar 21, 2024
@andrewbranch
Copy link
Member Author

@typescript-bot test top400
@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 21, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
test top400 ✅ Started 👀 Results
perf test this ✅ Started 👀 Results

@typescript-bot
Copy link
Collaborator

@andrewbranch
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Angular - node (v18.15.0, x64)
Memory used 295,533k (± 0.00%) 296,576k (± 0.01%) +1,042k (+ 0.35%) 296,555k 296,596k p=0.005 n=6
Parse Time 2.66s (± 0.31%) 2.69s (± 0.23%) +0.03s (+ 1.25%) 2.68s 2.70s p=0.003 n=6
Bind Time 0.82s (± 0.50%) 0.83s (± 0.00%) +0.01s (+ 1.01%) 0.83s 0.83s p=0.007 n=6
Check Time 8.19s (± 0.44%) 8.27s (± 0.42%) +0.07s (+ 0.92%) 8.23s 8.33s p=0.012 n=6
Emit Time 7.05s (± 0.27%) 7.02s (± 0.25%) -0.03s (- 0.40%) 7.00s 7.05s p=0.028 n=6
Total Time 18.72s (± 0.25%) 18.81s (± 0.21%) +0.09s (+ 0.46%) 18.76s 18.87s p=0.019 n=6
Compiler-Unions - node (v18.15.0, x64)
Memory used 193,782k (± 0.97%) 193,794k (± 1.02%) ~ 191,935k 195,702k p=0.810 n=6
Parse Time 1.63s (± 1.73%) 1.62s (± 1.15%) ~ 1.59s 1.64s p=0.515 n=6
Bind Time 0.86s (± 0.87%) 0.86s (± 0.73%) ~ 0.85s 0.87s p=0.718 n=6
Check Time 11.24s (± 0.95%) 11.22s (± 1.02%) ~ 11.10s 11.39s p=0.573 n=6
Emit Time 3.14s (± 0.62%) 3.14s (± 1.13%) ~ 3.09s 3.17s p=0.683 n=6
Total Time 16.87s (± 0.69%) 16.85s (± 0.59%) ~ 16.76s 16.99s p=0.688 n=6
Monaco - node (v18.15.0, x64)
Memory used 347,388k (± 0.00%) 348,464k (± 0.01%) +1,076k (+ 0.31%) 348,439k 348,489k p=0.005 n=6
Parse Time 2.48s (± 0.30%) 2.54s (± 0.41%) +0.07s (+ 2.69%) 2.53s 2.56s p=0.005 n=6
Bind Time 0.93s (± 0.44%) 0.93s (± 0.56%) ~ 0.92s 0.93s p=0.595 n=6
Check Time 7.01s (± 0.44%) 7.02s (± 0.64%) ~ 6.98s 7.11s p=0.687 n=6
Emit Time 4.05s (± 0.34%) 4.05s (± 0.33%) ~ 4.04s 4.07s p=0.804 n=6
Total Time 14.46s (± 0.23%) 14.54s (± 0.33%) +0.08s (+ 0.58%) 14.51s 14.64s p=0.006 n=6
TFS - node (v18.15.0, x64)
Memory used 302,719k (± 0.00%) 303,028k (± 0.01%) +309k (+ 0.10%) 302,984k 303,044k p=0.005 n=6
Parse Time 2.01s (± 1.12%) 2.01s (± 0.44%) ~ 2.00s 2.02s p=0.934 n=6
Bind Time 1.00s (± 0.55%) 1.00s (± 0.51%) +0.01s (+ 0.84%) 1.00s 1.01s p=0.038 n=6
Check Time 6.31s (± 0.36%) 6.34s (± 0.38%) ~ 6.31s 6.38s p=0.072 n=6
Emit Time 3.61s (± 0.51%) 3.60s (± 0.45%) ~ 3.58s 3.62s p=0.325 n=6
Total Time 12.93s (± 0.28%) 12.96s (± 0.27%) ~ 12.91s 12.99s p=0.197 n=6
material-ui - node (v18.15.0, x64)
Memory used 509,885k (± 0.01%) 510,944k (± 0.01%) +1,059k (+ 0.21%) 510,866k 511,004k p=0.005 n=6
Parse Time 3.18s (± 0.65%) 3.23s (± 0.60%) +0.05s (+ 1.52%) 3.20s 3.25s p=0.008 n=6
Bind Time 1.18s (± 1.07%) 1.18s (± 1.13%) ~ 1.16s 1.20s p=1.000 n=6
Check Time 20.48s (± 0.55%) 20.56s (± 0.36%) ~ 20.46s 20.64s p=0.261 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 24.84s (± 0.39%) 24.97s (± 0.34%) +0.13s (+ 0.51%) 24.83s 25.05s p=0.045 n=6
mui-docs - node (v18.15.0, x64)
Memory used 1,737,535k (± 0.00%) 1,743,152k (± 0.00%) +5,617k (+ 0.32%) 1,743,093k 1,743,194k p=0.005 n=6
Parse Time 6.56s (± 0.27%) 6.78s (± 0.39%) +0.22s (+ 3.33%) 6.76s 6.82s p=0.005 n=6
Bind Time 2.35s (± 0.47%) 2.35s (± 0.71%) ~ 2.32s 2.36s p=0.667 n=6
Check Time 56.29s (± 0.33%) 56.25s (± 0.14%) ~ 56.16s 56.36s p=0.748 n=6
Emit Time 0.13s (± 0.00%) 0.15s (± 3.77%) 🔻+0.02s (+11.54%) 0.14s 0.15s p=0.002 n=6
Total Time 65.33s (± 0.28%) 65.53s (± 0.13%) ~ 65.45s 65.64s p=0.066 n=6
self-build-src - node (v18.15.0, x64)
Memory used 2,393,473k (± 0.04%) 2,394,535k (± 0.04%) ~ 2,393,418k 2,395,490k p=0.093 n=6
Parse Time 5.02s (± 0.67%) 5.00s (± 0.79%) ~ 4.95s 5.06s p=0.521 n=6
Bind Time 1.89s (± 0.70%) 1.91s (± 0.61%) +0.02s (+ 1.24%) 1.90s 1.93s p=0.018 n=6
Check Time 33.56s (± 0.26%) 33.47s (± 0.22%) ~ 33.36s 33.55s p=0.078 n=6
Emit Time 2.64s (± 0.95%) 2.61s (± 1.80%) ~ 2.57s 2.67s p=0.377 n=6
Total Time 43.11s (± 0.20%) 43.01s (± 0.24%) ~ 42.88s 43.13s p=0.128 n=6
self-compiler - node (v18.15.0, x64)
Memory used 415,205k (± 0.01%) 415,437k (± 0.00%) +232k (+ 0.06%) 415,425k 415,454k p=0.005 n=6
Parse Time 3.40s (± 0.37%) 3.39s (± 1.33%) ~ 3.33s 3.45s p=0.375 n=6
Bind Time 1.27s (± 0.32%) 1.28s (± 0.43%) +0.01s (+ 1.05%) 1.28s 1.29s p=0.006 n=6
Check Time 18.01s (± 0.44%) 18.02s (± 0.32%) ~ 17.95s 18.10s p=0.518 n=6
Emit Time 1.33s (± 0.57%) 1.33s (± 0.91%) ~ 1.32s 1.35s p=0.503 n=6
Total Time 24.01s (± 0.31%) 24.03s (± 0.31%) ~ 23.95s 24.14s p=0.630 n=6
vscode - node (v18.15.0, x64)
Memory used 2,889,651k (± 0.00%) 2,894,745k (± 0.00%) +5,094k (+ 0.18%) 2,894,620k 2,894,859k p=0.005 n=6
Parse Time 12.94s (± 0.35%) 13.32s (± 0.24%) +0.37s (+ 2.90%) 13.27s 13.36s p=0.005 n=6
Bind Time 4.14s (± 1.12%) 4.13s (± 0.52%) ~ 4.10s 4.16s p=0.686 n=6
Check Time 71.58s (± 0.50%) 71.94s (± 0.50%) ~ 71.52s 72.34s p=0.173 n=6
Emit Time 19.39s (± 0.23%) 20.16s (± 8.10%) ~ 19.38s 23.48s p=0.091 n=6
Total Time 108.05s (± 0.32%) 109.54s (± 1.68%) +1.50s (+ 1.38%) 108.46s 113.22s p=0.005 n=6
webpack - node (v18.15.0, x64)
Memory used 408,124k (± 0.01%) 408,745k (± 0.01%) +621k (+ 0.15%) 408,701k 408,833k p=0.005 n=6
Parse Time 3.24s (± 0.30%) 3.27s (± 0.84%) +0.03s (+ 0.87%) 3.23s 3.31s p=0.042 n=6
Bind Time 1.39s (± 0.84%) 1.40s (± 0.29%) ~ 1.40s 1.41s p=0.102 n=6
Check Time 14.23s (± 0.22%) 14.32s (± 0.32%) +0.09s (+ 0.63%) 14.26s 14.39s p=0.008 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 18.86s (± 0.18%) 18.99s (± 0.31%) +0.13s (+ 0.69%) 18.93s 19.10s p=0.005 n=6
xstate - node (v18.15.0, x64)
Memory used 513,045k (± 0.02%) 513,859k (± 0.02%) +814k (+ 0.16%) 513,754k 513,961k p=0.005 n=6
Parse Time 3.95s (± 0.42%) 4.03s (± 0.43%) +0.07s (+ 1.81%) 4.00s 4.05s p=0.005 n=6
Bind Time 1.86s (± 0.79%) 1.85s (± 0.65%) ~ 1.84s 1.87s p=0.503 n=6
Check Time 3.38s (± 0.74%) 3.38s (± 0.49%) ~ 3.36s 3.40s p=0.372 n=6
Emit Time 0.09s (± 6.44%) 0.09s (± 4.45%) 🔻+0.01s (+ 7.84%) 0.09s 0.10s p=0.003 n=6
Total Time 9.28s (± 0.25%) 9.36s (± 0.33%) +0.08s (+ 0.88%) 9.31s 9.39s p=0.008 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Angular - node (v18.15.0, x64)
  • Compiler-Unions - node (v18.15.0, x64)
  • Monaco - node (v18.15.0, x64)
  • TFS - node (v18.15.0, x64)
  • material-ui - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

tsserver

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-UnionsTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,844ms (± 1.26%) 2,877ms (± 0.25%) +33ms (+ 1.17%) 2,868ms 2,889ms p=0.005 n=6
Req 2 - geterr 6,666ms (± 0.79%) 6,767ms (± 0.45%) +101ms (+ 1.52%) 6,737ms 6,821ms p=0.005 n=6
Req 3 - references 387ms (± 1.12%) 393ms (± 1.08%) +6ms (+ 1.51%) 390ms 401ms p=0.045 n=6
Req 4 - navto 334ms (± 0.24%) 329ms (± 0.00%) -5ms (- 1.60%) 329ms 329ms p=0.002 n=6
Req 5 - completionInfo count 1,357 (± 0.00%) 1,357 (± 0.00%) ~ 1,357 1,357 p=1.000 n=6
Req 5 - completionInfo 105ms (± 1.11%) 119ms (± 2.12%) 🔻+14ms (+13.15%) 117ms 124ms p=0.005 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,494ms (± 0.86%) 2,502ms (± 1.14%) ~ 2,448ms 2,529ms p=0.298 n=6
Req 2 - geterr 4,140ms (± 1.35%) 4,132ms (± 0.28%) ~ 4,112ms 4,141ms p=0.689 n=6
Req 3 - references 334ms (± 0.84%) 333ms (± 0.49%) ~ 331ms 334ms p=0.677 n=6
Req 4 - navto 294ms (± 0.51%) 298ms (± 2.40%) ~ 294ms 312ms p=0.210 n=6
Req 5 - completionInfo count 1,519 (± 0.00%) 1,519 (± 0.00%) ~ 1,519 1,519 p=1.000 n=6
Req 5 - completionInfo 74ms (± 2.70%) 76ms (± 8.40%) ~ 73ms 89ms p=0.652 n=6
xstateTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 3,095ms (± 0.65%) 3,168ms (± 0.54%) +74ms (+ 2.38%) 3,141ms 3,186ms p=0.005 n=6
Req 2 - geterr 2,326ms (± 7.72%) 2,393ms (± 9.01%) ~ 1,967ms 2,550ms p=0.093 n=6
Req 3 - references 149ms (± 1.67%) 147ms (± 1.09%) ~ 145ms 150ms p=0.102 n=6
Req 4 - navto 554ms (± 0.24%) 559ms (± 1.59%) ~ 550ms 571ms p=0.513 n=6
Req 5 - completionInfo count 2,079 (± 0.00%) 2,079 (± 0.00%) ~ 2,079 2,079 p=1.000 n=6
Req 5 - completionInfo 451ms (± 1.16%) 475ms (± 1.77%) 🔻+23ms (+ 5.17%) 467ms 491ms p=0.005 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • CompilerTSServer - node (v18.15.0, x64)
  • Compiler-UnionsTSServer - node (v18.15.0, x64)
  • xstateTSServer - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

startup

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
tsc-startup - node (v18.15.0, x64)
Execution time 152.27ms (± 0.16%) 152.20ms (± 0.15%) -0.07ms (- 0.04%) 151.17ms 155.62ms p=0.036 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time 225.27ms (± 0.15%) 225.18ms (± 0.18%) -0.09ms (- 0.04%) 223.85ms 234.59ms p=0.001 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time 269.82ms (± 0.30%) 269.96ms (± 0.34%) +0.14ms (+ 0.05%) 262.76ms 286.74ms p=0.006 n=600
typescript-startup - node (v18.15.0, x64)
Execution time 269.85ms (± 0.31%) 270.03ms (± 0.31%) +0.18ms (+ 0.07%) 262.87ms 278.28ms p=0.008 n=600
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • tsc-startup - node (v18.15.0, x64)
  • tsserver-startup - node (v18.15.0, x64)
  • tsserverlibrary-startup - node (v18.15.0, x64)
  • typescript-startup - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

@andrewbranch Here are the results of running the top 400 repos comparing main and refs/pull/57896/merge:

Something interesting changed - please have a look.

Details

microsoft/playwright

4 of 15 projects failed to build with the old tsc and were ignored

packages/html-reporter/tsconfig.json

@jakebailey
Copy link
Member

  • When module is preserve, ESM import/export declarations are now forbidden in .cts/.cjs files, as well as in .ts/.js files when the nearest package.json has "type": "commonjs". We want to ensure that --module preserve means the module syntax you write gets emitted without significant transformation, but we also want to prevent ESM syntax from being used in unambiguously CommonJS files, so this situation acts much like verbatimModuleSyntax is enabled.

FWIW this does not match the behavior of esbuild or bun; both accept import statements with those file extensions:

$ cat index.cts
import fs from "fs";

console.log("my code is:");
console.log(fs.readFileSync(__filename, "utf8"));

$ bun run index.cts
my code is:
import fs from "fs";

console.log("my code is:");
console.log(fs.readFileSync(__filename, "utf8"));

$ bunx esbuild --platform=node --bundle index.cts
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __reExport = (target, module2, copyDefault, desc) => {
  if (module2 && typeof module2 === "object" || typeof module2 === "function") {
    for (let key of __getOwnPropNames(module2))
      if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
        __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
  }
  return target;
};
var __toESM = (module2, isNodeMode) => {
  return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};

// index.cts
var import_fs = __toESM(require("fs"));
console.log("my code is:");
console.log(import_fs.default.readFileSync(__filename, "utf8"));

I'm not totally sure how widespread this is, though. But it does in general make me nervous about making files stricter based on type=... semantics (especially in the mode which vscode will be using for all users?)

@andrewbranch
Copy link
Member Author

@jakebailey but if you make those file extensions .cjs instead of .cts?

@jakebailey
Copy link
Member

Works the same:

$ bun run index.cjs
my code is:
import fs from "fs";

console.log("my code is:");
console.log(fs.readFileSync(__filename, "utf8"));

$ bunx esbuild --platform=node --bundle index.cjs
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __reExport = (target, module2, copyDefault, desc) => {
  if (module2 && typeof module2 === "object" || typeof module2 === "function") {
    for (let key of __getOwnPropNames(module2))
      if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
        __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
  }
  return target;
};
var __toESM = (module2, isNodeMode) => {
  return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};

// index.cjs
var import_fs = __toESM(require("fs"));
console.log("my code is:");
console.log(import_fs.default.readFileSync(__filename, "utf8"));

@andrewbranch
Copy link
Member Author

I think it’s ok for us to be more restrictive and opinionated than any single bundler or runtime here. It’s in Bun’s best interest to make plausibly interpretable input code execute without errors. tsc outputs can and will often be used across a wide variety of compilers and runtimes, so we have an interest in making sure they’re not footguns. And I don’t see any real reason why someone would want to emit an import into a .cjs file.

@jakebailey
Copy link
Member

Sure, the CJS thing isn't so bad; from my reading this PR doesn't prevent people from using the icky "set module=esnext to emit ESM" trick, so I don't think there are any extra cases I'm concerned about off the top of my head.

// source file.
return transformImpliedNodeFormatDependentModule;
case ModuleKind.System:
return transformSystemModule;
default:
return transformModule;
Copy link
Member

Choose a reason for hiding this comment

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

Should we just make this switch exhaustive? This last case is really only for ModuleKind.None, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

AMD/UMD too

src/compiler/utilities.ts Outdated Show resolved Hide resolved
Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

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

With #57931 I think this is all good.

@andrewbranch andrewbranch added the Breaking Change Would introduce errors in existing code label Mar 26, 2024
src/compiler/utilities.ts Outdated Show resolved Hide resolved
src/compiler/checker.ts Outdated Show resolved Hide resolved
src/compiler/checker.ts Outdated Show resolved Hide resolved
src/compiler/moduleSpecifiers.ts Outdated Show resolved Hide resolved
src/compiler/program.ts Show resolved Hide resolved
src/compiler/program.ts Show resolved Hide resolved
src/services/codefixes/importFixes.ts Outdated Show resolved Hide resolved
@andrewbranch andrewbranch merged commit 585a9af into microsoft:main Apr 12, 2024
25 checks passed
@andrewbranch andrewbranch deleted the always-set-implied-node-format branch April 12, 2024 19:47
andrewbranch added a commit that referenced this pull request Jun 12, 2024
andrewbranch added a commit that referenced this pull request Jun 13, 2024
…e-5.5 (#58848)

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
Co-authored-by: Andrew Branch <andrew@wheream.io>
andrewbranch added a commit to andrewbranch/TypeScript that referenced this pull request Jun 13, 2024
… extensions in more `module` modes (microsoft#57896)"

This reverts commit 585a9af.
andrewbranch added a commit to andrewbranch/TypeScript that referenced this pull request Jun 13, 2024
… extensions in more `module` modes (microsoft#57896)"

This reverts commit 585a9af.
@andrewbranch andrewbranch mentioned this pull request Jun 13, 2024
andrewbranch added a commit to andrewbranch/TypeScript that referenced this pull request Jun 13, 2024
… extensions in more `module` modes (microsoft#57896)"

This reverts commit 585a9af.
andrewbranch added a commit that referenced this pull request Jun 13, 2024
andrewbranch added a commit to andrewbranch/TypeScript that referenced this pull request Jun 17, 2024
…fic file extensions in more `module` modes (microsoft#57896)""

This reverts commit d3c8f08.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team Breaking Change Would introduce errors in existing code For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
5 participants