Skip to content

Switch 'name' to 'void', mark as deprecated. #883

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
Sep 10, 2020
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
3 changes: 2 additions & 1 deletion baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19505,7 +19505,8 @@ declare var location: Location;
declare var locationbar: BarProp;
declare var menubar: BarProp;
declare var msContentScript: ExtensionScriptApis;
declare const name: never;
/** @deprecated */
declare const name: void;
declare var navigator: Navigator;
declare var offscreenBuffering: string | boolean;
declare var oncompassneedscalibration: ((this: Window, ev: Event) => any) | null;
Expand Down
7 changes: 5 additions & 2 deletions src/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,12 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor, iterator: boo
function emitProperty(prefix: string, i: Browser.Interface, emitScope: EmitScope, p: Browser.Property) {
emitComments(p, printer.printLine);

// Treat window.name specially because of https://github.com/Microsoft/TypeScript/issues/9850
// Treat window.name specially because of
// - https://github.com/Microsoft/TypeScript/issues/9850
// - https://github.com/microsoft/TypeScript/issues/18433
if (p.name === "name" && i.name === "Window" && emitScope === EmitScope.All) {
printer.printLine("declare const name: never;");
printer.printLine("/** @deprecated */");
printer.printLine("declare const name: void;");
}
else {
let pType: string;
Expand Down