Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Commit 8872147

Browse files
committed
ignore webpack's single-letter properties
1 parent 370278e commit 8872147

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

index.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ The JavaScript module exports a property named 'foo', which is missing from the
9999
}
100100
]));
101101
},
102+
noMissingWebpackProperty() {
103+
expect(checkSource(
104+
"missingJsProperty",
105+
"testsource/webpackPropertyNames.d.ts",
106+
"testsource/webpackPropertyNames.js",
107+
allErrors,
108+
false,
109+
)).toHaveLength(0);
110+
},
102111
missingDtsProperty() {
103112
expect(checkSource(
104113
"missingDtsProperty",
@@ -247,4 +256,4 @@ Try adding -browser to the end of the name to get
247256
},
248257
]);
249258
}
250-
});
259+
});

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ function getDtsDefaultExport(sourceFile: ts.SourceFile, moduleType: InferenceRes
703703
return undefined;
704704
}
705705

706-
const ignoredProperties = ["__esModule", "prototype", "default"];
706+
const ignoredProperties = ["__esModule", "prototype", "default", "F", "G", "S", "P", "B", "W", "U", "R"];
707707

708708
function ignoreProperty(property: ts.Symbol): boolean {
709709
const name = property.getName();

testsource/webpackPropertyNames.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export var normal: string;

testsource/webpackPropertyNames.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var $export = {};
2+
// type bitmap
3+
$export.F = 1; // forced
4+
$export.G = 2; // global
5+
$export.S = 4; // static
6+
$export.P = 8; // proto
7+
$export.B = 16; // bind
8+
$export.W = 32; // wrap
9+
$export.U = 64; // safe
10+
$export.R = 128; // real proto method for `library`
11+
$export.normal = "hi";
12+
module.exports = $export;

0 commit comments

Comments
 (0)