Skip to content

Remove redundant added types #647

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

Merged
merged 3 commits into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ interface EffectTiming {
iterations?: number;
}

interface ElementCreationOptions {
is?: string;
}

interface ElementDefinitionOptions {
extends?: string;
}
Expand Down Expand Up @@ -2282,11 +2286,6 @@ declare var BroadcastChannel: {
new(name: string): BroadcastChannel;
};

interface BroadcastChannelEventMap {
message: MessageEvent;
messageerror: MessageEvent;
}

/** The ByteLengthQueuingStrategy interface of the the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. */
interface ByteLengthQueuingStrategy extends QueuingStrategy<ArrayBufferView> {
highWaterMark: number;
Expand Down Expand Up @@ -4990,10 +4989,6 @@ interface ElementContentEditable {
readonly isContentEditable: boolean;
}

interface ElementCreationOptions {
is?: string;
}

/** The ErrorEvent interface represents events providing information related to errors in scripts or in files. */
interface ErrorEvent extends Event {
readonly colno: number;
Expand Down Expand Up @@ -10786,15 +10781,6 @@ interface NodeListOf<TNode extends Node> extends NodeList {
[index: number]: TNode;
}

interface NodeSelector {
querySelector<K extends keyof HTMLElementTagNameMap>(selectors: K): HTMLElementTagNameMap[K] | null;
querySelector<K extends keyof SVGElementTagNameMap>(selectors: K): SVGElementTagNameMap[K] | null;
querySelector<E extends Element = Element>(selectors: string): E | null;
querySelectorAll<K extends keyof HTMLElementTagNameMap>(selectors: K): NodeListOf<HTMLElementTagNameMap[K]>;
querySelectorAll<K extends keyof SVGElementTagNameMap>(selectors: K): NodeListOf<SVGElementTagNameMap[K]>;
querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
}

interface NonDocumentTypeChildNode {
/**
* Returns the first following sibling that
Expand Down
5 changes: 0 additions & 5 deletions baselines/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,6 @@ declare var BroadcastChannel: {
new(name: string): BroadcastChannel;
};

interface BroadcastChannelEventMap {
message: MessageEvent;
messageerror: MessageEvent;
}

/** The ByteLengthQueuingStrategy interface of the the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. */
interface ByteLengthQueuingStrategy extends QueuingStrategy<ArrayBufferView> {
highWaterMark: number;
Expand Down
99 changes: 0 additions & 99 deletions inputfiles/addedTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,30 +193,6 @@
}
}
}
},
"ParentNode": {
"name": "ParentNode",
"exposed": "Window",
"properties": {
"property": {
"firstElementChild": {
"name": "firstElementChild",
"read-only": 1,
"override-type": "Element | null"
},
"lastElementChild": {
"name": "lastElementChild",
"read-only": 1,
"override-type": "Element | null"
},
"childElementCount": {
"name": "childElementCount",
"read-only": 1,
"override-type": "number"
}
}
},
"no-interface-object": "1"
}
}
},
Expand Down Expand Up @@ -417,22 +393,6 @@
}
]
},
"BroadcastChannelEventMap": {
"name": "BroadcastChannelEventMap",
"properties": {
"property": {
"message": {
"name": "message",
"override-type": "MessageEvent"
},
"messageerror": {
"name": "messageerror",
"override-type": "MessageEvent"
}
}
},
"no-interface-object": "1"
},
"CSSStyleDeclaration": {
"name": "CSSStyleDeclaration",
"properties": {
Expand Down Expand Up @@ -1153,20 +1113,6 @@
}
}
},
"ElementCreationOptions": {
"name": "ElementCreationOptions",
"exposed": "Window",
"properties": {
"property": {
"is": {
"name": "is",
"override-type": "string",
"required": 0
}
}
},
"no-interface-object": "1"
},
"HTMLMainElement": {
"name": "HTMLMainElement",
"extends": "HTMLElement",
Expand Down Expand Up @@ -1717,51 +1663,6 @@
}
]
},
"NodeSelector": {
"name": "NodeSelector",
"extends": "Object",
"no-interface-object": "1",
"methods": {
"method": {
"querySelectorAll": {
"signature": [
{
"param-min-required": 1,
"type": "NodeList",
"param": [
{
"name": "selectors",
"type": "DOMString",
"type-original": "DOMString"
}
],
"type-original": "NodeList"
}
],
"name": "querySelectorAll"
},
"querySelector": {
"signature": [
{
"nullable": 1,
"param-min-required": 1,
"type": "Element",
"param": [
{
"name": "selectors",
"type": "DOMString",
"type-original": "DOMString"
}
],
"type-original": "Element?"
}
],
"name": "querySelector"
}
}
},
"exposed": "Window"
},
"CSS": {
"name": "CSS",
"methods": {
Expand Down
13 changes: 0 additions & 13 deletions inputfiles/overridingTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -2415,19 +2415,6 @@
]
}
},
"BroadcastChannel": {
"name": "BroadcastChannel",
"methods": {
"method": {
"postMessage": {
"name": "postMessage",
"override-signatures": [
"postMessage(message: any): void"
]
}
}
}
},
"MessagePort": {
"name": "MessagePort",
"methods": {
Expand Down
16 changes: 4 additions & 12 deletions src/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,8 @@ function createTextWriter(newLine: string) {
/** print declarations conflicting with base interface to a side list to write them under a diffrent name later */
let stack: { content: string, indent: number }[] = [];

const indentStrings: string[] = ["", " "];
function getIndentString(level: number) {
if (indentStrings[level] === undefined) {
indentStrings[level] = getIndentString(level - 1) + indentStrings[1];
}
return indentStrings[level];
return " ".repeat(level);
}

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

return {
reset: reset,
reset,

resetIndent() { indent = 0; },
increaseIndent() { indent++; },
decreaseIndent() { indent--; },

endLine: endLine,
endLine,
print: write,
printLine(c: string) { write(c); endLine(); },

Expand Down Expand Up @@ -830,7 +825,7 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
.filter(i => i !== "Object")
.map(processIName));

if (finalExtends && finalExtends.length) {
if (finalExtends.length) {
printer.print(` extends ${finalExtends.join(", ")}`);
}
printer.print(" {");
Expand Down Expand Up @@ -916,7 +911,6 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
printer.clearStack();
emitInterfaceEventMap(i);

printer.resetIndent();
emitInterfaceDeclaration(i);
printer.increaseIndent();

Expand Down Expand Up @@ -950,7 +944,6 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
// Because in the two cases the interface contains different things, it might be easier to
// read to separate them into two functions.
function emitStaticInterfaceWithNonStaticMembers() {
printer.resetIndent();
emitInterfaceDeclaration(i);
printer.increaseIndent();

Expand All @@ -971,7 +964,6 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
}

function emitPureStaticInterface() {
printer.resetIndent();
emitInterfaceDeclaration(i);
printer.increaseIndent();

Expand Down
2 changes: 1 addition & 1 deletion src/idlfetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function extractCSSDefinitions(dom: DocumentFragment) {
properties.map(property => `\n [CEReactions] attribute [TreatNullAs=EmptyString] CSSOMString ${
hyphenToCamelCase(property)
};`).join("")
}\n};`
}\n};`;
}

function hyphenToCamelCase(name: string) {
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ function emitDom() {
const tsWebIteratorsOutput = path.join(outputFolder, "dom.iterable.generated.d.ts");
const tsWorkerOutput = path.join(outputFolder, "webworker.generated.d.ts");


const overriddenItems = require(path.join(inputFolder, "overridingTypes.json"));
const addedItems = require(path.join(inputFolder, "addedTypes.json"));
const comments = require(path.join(inputFolder, "comments.json"));
Expand Down