Skip to content

Commit 39360d9

Browse files
authored
fix(types): Remove usage of allowSyntheticDefaultImports (#11073)
The TypeScript docs say > `allowSyntheticDefaultImports` without `esModuleInterop` should be avoided. It changes the compiler’s checking behavior without changing the code emitted by tsc, allowing potentially unsafe JavaScript to be emitted. Additionally, the checking changes it introduces are an incomplete version of the ones introduced by `esModuleInterop`.
1 parent 5039e84 commit 39360d9

File tree

4 files changed

+3
-6
lines changed

4 files changed

+3
-6
lines changed

dev-packages/browser-integration-tests/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"lib": ["dom", "es2019"],
66
"moduleResolution": "node",
77
"noEmit": true,
8-
"strict": true
8+
"strict": true,
9+
"allowSyntheticDefaultImports": true
910
},
1011
"include": ["**/*.ts"],
1112
"exclude": ["node_modules"]

packages/nextjs/src/config/loaders/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type webpack from 'webpack';
1+
import type * as webpack from 'webpack';
22

33
export type LoaderThis<Options> = {
44
/**

packages/node/src/proxy/index.ts

-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
/* eslint-disable @typescript-eslint/explicit-member-accessibility */
3030
/* eslint-disable @typescript-eslint/no-unused-vars */
31-
import assert from 'assert';
3231
import type * as http from 'http';
3332
import type { OutgoingHttpHeaders } from 'http';
3433
import * as net from 'net';
@@ -190,8 +189,6 @@ export class HttpsProxyAgent<Uri extends string> extends Agent {
190189
// Need to wait for the "socket" event to re-play the "data" events.
191190
req.once('socket', (s: net.Socket) => {
192191
debug('Replaying proxy buffer for failed request');
193-
assert(s.listenerCount('data') > 0);
194-
195192
// Replay the "buffered" Buffer onto the fake `socket`, since at
196193
// this point the HTTP module machinery has been hooked up for
197194
// the user.

tsconfig.json

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"extends": "./packages/typescript/tsconfig.json",
33

44
"compilerOptions": {
5-
"allowSyntheticDefaultImports": true,
65
"declaration": false,
76
"declarationMap": false,
87
"skipLibCheck": true,

0 commit comments

Comments
 (0)