Skip to content

Commit 4752f02

Browse files
authored
Merge pull request #647 from saschanaz/cleanup2
Remove redundant added types
2 parents 9e213c7 + a9906eb commit 4752f02

File tree

7 files changed

+9
-149
lines changed

7 files changed

+9
-149
lines changed

baselines/dom.generated.d.ts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,10 @@ interface EffectTiming {
392392
iterations?: number;
393393
}
394394

395+
interface ElementCreationOptions {
396+
is?: string;
397+
}
398+
395399
interface ElementDefinitionOptions {
396400
extends?: string;
397401
}
@@ -2282,11 +2286,6 @@ declare var BroadcastChannel: {
22822286
new(name: string): BroadcastChannel;
22832287
};
22842288

2285-
interface BroadcastChannelEventMap {
2286-
message: MessageEvent;
2287-
messageerror: MessageEvent;
2288-
}
2289-
22902289
/** The ByteLengthQueuingStrategy interface of the the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. */
22912290
interface ByteLengthQueuingStrategy extends QueuingStrategy<ArrayBufferView> {
22922291
highWaterMark: number;
@@ -4989,10 +4988,6 @@ interface ElementContentEditable {
49894988
readonly isContentEditable: boolean;
49904989
}
49914990

4992-
interface ElementCreationOptions {
4993-
is?: string;
4994-
}
4995-
49964991
/** The ErrorEvent interface represents events providing information related to errors in scripts or in files. */
49974992
interface ErrorEvent extends Event {
49984993
readonly colno: number;
@@ -10788,15 +10783,6 @@ interface NodeListOf<TNode extends Node> extends NodeList {
1078810783
[index: number]: TNode;
1078910784
}
1079010785

10791-
interface NodeSelector {
10792-
querySelector<K extends keyof HTMLElementTagNameMap>(selectors: K): HTMLElementTagNameMap[K] | null;
10793-
querySelector<K extends keyof SVGElementTagNameMap>(selectors: K): SVGElementTagNameMap[K] | null;
10794-
querySelector<E extends Element = Element>(selectors: string): E | null;
10795-
querySelectorAll<K extends keyof HTMLElementTagNameMap>(selectors: K): NodeListOf<HTMLElementTagNameMap[K]>;
10796-
querySelectorAll<K extends keyof SVGElementTagNameMap>(selectors: K): NodeListOf<SVGElementTagNameMap[K]>;
10797-
querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
10798-
}
10799-
1080010786
interface NonDocumentTypeChildNode {
1080110787
/**
1080210788
* Returns the first following sibling that

baselines/webworker.generated.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -581,11 +581,6 @@ declare var BroadcastChannel: {
581581
new(name: string): BroadcastChannel;
582582
};
583583

584-
interface BroadcastChannelEventMap {
585-
message: MessageEvent;
586-
messageerror: MessageEvent;
587-
}
588-
589584
/** The ByteLengthQueuingStrategy interface of the the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. */
590585
interface ByteLengthQueuingStrategy extends QueuingStrategy<ArrayBufferView> {
591586
highWaterMark: number;

inputfiles/addedTypes.json

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -193,30 +193,6 @@
193193
}
194194
}
195195
}
196-
},
197-
"ParentNode": {
198-
"name": "ParentNode",
199-
"exposed": "Window",
200-
"properties": {
201-
"property": {
202-
"firstElementChild": {
203-
"name": "firstElementChild",
204-
"read-only": 1,
205-
"override-type": "Element | null"
206-
},
207-
"lastElementChild": {
208-
"name": "lastElementChild",
209-
"read-only": 1,
210-
"override-type": "Element | null"
211-
},
212-
"childElementCount": {
213-
"name": "childElementCount",
214-
"read-only": 1,
215-
"override-type": "number"
216-
}
217-
}
218-
},
219-
"no-interface-object": "1"
220196
}
221197
}
222198
},
@@ -417,22 +393,6 @@
417393
}
418394
]
419395
},
420-
"BroadcastChannelEventMap": {
421-
"name": "BroadcastChannelEventMap",
422-
"properties": {
423-
"property": {
424-
"message": {
425-
"name": "message",
426-
"override-type": "MessageEvent"
427-
},
428-
"messageerror": {
429-
"name": "messageerror",
430-
"override-type": "MessageEvent"
431-
}
432-
}
433-
},
434-
"no-interface-object": "1"
435-
},
436396
"CSSStyleDeclaration": {
437397
"name": "CSSStyleDeclaration",
438398
"properties": {
@@ -1152,20 +1112,6 @@
11521112
}
11531113
}
11541114
},
1155-
"ElementCreationOptions": {
1156-
"name": "ElementCreationOptions",
1157-
"exposed": "Window",
1158-
"properties": {
1159-
"property": {
1160-
"is": {
1161-
"name": "is",
1162-
"override-type": "string",
1163-
"required": 0
1164-
}
1165-
}
1166-
},
1167-
"no-interface-object": "1"
1168-
},
11691115
"HTMLMainElement": {
11701116
"name": "HTMLMainElement",
11711117
"extends": "HTMLElement",
@@ -1716,51 +1662,6 @@
17161662
}
17171663
]
17181664
},
1719-
"NodeSelector": {
1720-
"name": "NodeSelector",
1721-
"extends": "Object",
1722-
"no-interface-object": "1",
1723-
"methods": {
1724-
"method": {
1725-
"querySelectorAll": {
1726-
"signature": [
1727-
{
1728-
"param-min-required": 1,
1729-
"type": "NodeList",
1730-
"param": [
1731-
{
1732-
"name": "selectors",
1733-
"type": "DOMString",
1734-
"type-original": "DOMString"
1735-
}
1736-
],
1737-
"type-original": "NodeList"
1738-
}
1739-
],
1740-
"name": "querySelectorAll"
1741-
},
1742-
"querySelector": {
1743-
"signature": [
1744-
{
1745-
"nullable": 1,
1746-
"param-min-required": 1,
1747-
"type": "Element",
1748-
"param": [
1749-
{
1750-
"name": "selectors",
1751-
"type": "DOMString",
1752-
"type-original": "DOMString"
1753-
}
1754-
],
1755-
"type-original": "Element?"
1756-
}
1757-
],
1758-
"name": "querySelector"
1759-
}
1760-
}
1761-
},
1762-
"exposed": "Window"
1763-
},
17641665
"CSS": {
17651666
"name": "CSS",
17661667
"methods": {

inputfiles/overridingTypes.json

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2419,19 +2419,6 @@
24192419
]
24202420
}
24212421
},
2422-
"BroadcastChannel": {
2423-
"name": "BroadcastChannel",
2424-
"methods": {
2425-
"method": {
2426-
"postMessage": {
2427-
"name": "postMessage",
2428-
"override-signatures": [
2429-
"postMessage(message: any): void"
2430-
]
2431-
}
2432-
}
2433-
}
2434-
},
24352422
"MessagePort": {
24362423
"name": "MessagePort",
24372424
"methods": {

src/emitter.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,8 @@ function createTextWriter(newLine: string) {
5959
/** print declarations conflicting with base interface to a side list to write them under a diffrent name later */
6060
let stack: { content: string, indent: number }[] = [];
6161

62-
const indentStrings: string[] = ["", " "];
6362
function getIndentString(level: number) {
64-
if (indentStrings[level] === undefined) {
65-
indentStrings[level] = getIndentString(level - 1) + indentStrings[1];
66-
}
67-
return indentStrings[level];
63+
return " ".repeat(level);
6864
}
6965

7066
function write(s: string) {
@@ -90,13 +86,12 @@ function createTextWriter(newLine: string) {
9086
reset();
9187

9288
return {
93-
reset: reset,
89+
reset,
9490

95-
resetIndent() { indent = 0; },
9691
increaseIndent() { indent++; },
9792
decreaseIndent() { indent--; },
9893

99-
endLine: endLine,
94+
endLine,
10095
print: write,
10196
printLine(c: string) { write(c); endLine(); },
10297

@@ -825,7 +820,7 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
825820
.filter(i => i !== "Object")
826821
.map(processIName));
827822

828-
if (finalExtends && finalExtends.length) {
823+
if (finalExtends.length) {
829824
printer.print(` extends ${finalExtends.join(", ")}`);
830825
}
831826
printer.print(" {");
@@ -911,7 +906,6 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
911906
printer.clearStack();
912907
emitInterfaceEventMap(i);
913908

914-
printer.resetIndent();
915909
emitInterfaceDeclaration(i);
916910
printer.increaseIndent();
917911

@@ -945,7 +939,6 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
945939
// Because in the two cases the interface contains different things, it might be easier to
946940
// read to separate them into two functions.
947941
function emitStaticInterfaceWithNonStaticMembers() {
948-
printer.resetIndent();
949942
emitInterfaceDeclaration(i);
950943
printer.increaseIndent();
951944

@@ -966,7 +959,6 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
966959
}
967960

968961
function emitPureStaticInterface() {
969-
printer.resetIndent();
970962
emitInterfaceDeclaration(i);
971963
printer.increaseIndent();
972964

src/idlfetcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function extractCSSDefinitions(dom: DocumentFragment) {
8080
properties.map(property => `\n [CEReactions] attribute [TreatNullAs=EmptyString] CSSOMString ${
8181
hyphenToCamelCase(property)
8282
};`).join("")
83-
}\n};`
83+
}\n};`;
8484
}
8585

8686
function hyphenToCamelCase(name: string) {

src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ function emitDom() {
3939
const tsWebIteratorsOutput = path.join(outputFolder, "dom.iterable.generated.d.ts");
4040
const tsWorkerOutput = path.join(outputFolder, "webworker.generated.d.ts");
4141

42-
4342
const overriddenItems = require(path.join(inputFolder, "overridingTypes.json"));
4443
const addedItems = require(path.join(inputFolder, "addedTypes.json"));
4544
const comments = require(path.join(inputFolder, "comments.json"));

0 commit comments

Comments
 (0)