Skip to content

Do not emit toString() on class static declarations #1513

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 1 commit into from
Mar 3, 2023
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
1 change: 0 additions & 1 deletion baselines/audioworklet.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,6 @@ interface URLSearchParams {
declare var URLSearchParams: {
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
toString(): string;
};

/** Available only in secure contexts. */
Expand Down
4 changes: 0 additions & 4 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4110,7 +4110,6 @@ declare var DOMMatrixReadOnly: {
fromFloat32Array(array32: Float32Array): DOMMatrixReadOnly;
fromFloat64Array(array64: Float64Array): DOMMatrixReadOnly;
fromMatrix(other?: DOMMatrixInit): DOMMatrixReadOnly;
toString(): string;
};

/** Provides the ability to parse XML or HTML source code from a string into a DOM Document. */
Expand Down Expand Up @@ -11751,7 +11750,6 @@ declare var Range: {
readonly START_TO_END: 1;
readonly END_TO_END: 2;
readonly END_TO_START: 3;
toString(): string;
};

interface ReadableByteStreamController {
Expand Down Expand Up @@ -13783,7 +13781,6 @@ interface Selection {
declare var Selection: {
prototype: Selection;
new(): Selection;
toString(): string;
};

interface ServiceWorkerEventMap extends AbstractWorkerEventMap {
Expand Down Expand Up @@ -14707,7 +14704,6 @@ interface URLSearchParams {
declare var URLSearchParams: {
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
toString(): string;
};

interface VTTCue extends TextTrackCue {
Expand Down
1 change: 0 additions & 1 deletion baselines/serviceworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3285,7 +3285,6 @@ interface URLSearchParams {
declare var URLSearchParams: {
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
toString(): string;
};

interface WEBGL_color_buffer_float {
Expand Down
1 change: 0 additions & 1 deletion baselines/sharedworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3149,7 +3149,6 @@ interface URLSearchParams {
declare var URLSearchParams: {
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
toString(): string;
};

interface WEBGL_color_buffer_float {
Expand Down
1 change: 0 additions & 1 deletion baselines/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3426,7 +3426,6 @@ interface URLSearchParams {
declare var URLSearchParams: {
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
toString(): string;
};

interface VideoColorSpace {
Expand Down
12 changes: 2 additions & 10 deletions src/build/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -909,15 +909,7 @@ export function emitWebIdl(
return emitQuerySelectorAllOverloads(m);
}

// ignore toString() provided from browser.webidl.preprocessed.json
// to prevent duplication
if (m.name !== "toString") {
emitSignatures(m, prefix, m.name, printLine);

if (m.stringifier) {
printLine("toString(): string;");
}
}
emitSignatures(m, prefix, m.name, printLine);
}

function emitSignature(
Expand Down Expand Up @@ -989,7 +981,7 @@ export function emitWebIdl(
.sort(compareName)
.forEach((m) => emitMethod(prefix, m, conflictedMembers));
}
if (i.anonymousMethods) {
if (i.anonymousMethods && emitScope === EmitScope.InstanceOnly) {
const stringifier = i.anonymousMethods.method.find((m) => m.stringifier);
if (stringifier) {
printer.printLine("toString(): string;");
Expand Down