Skip to content

[Web API type definition issue] "name" global variable should not be marked as deprecated #2175

@rwalle

Description

@rwalle

Summary

"name" global variable is not deprecated

Expected vs. Actual Behavior

Expected: The name global variable in the browser environment (which of course maps to window.name, which is a property on Window object) is not marked as deprecated on MDN website. The return type should also be string instead of void.

By evaluating name in dev tools of Chrome/Firefox, it is easy to see it is an empty string in a "normal" window.

Actual:

in lib.dom.d.ts:

/**
 * The `Window.name` property gets/sets the name of the window's browsing context.
 *
 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/name)
 */
/** @deprecated */
declare const name: void;

Playground Link

https://www.typescriptlang.org/play/?#code/MYewdgziA2CmB00QHMAUYCGBbWBKA3EA

Browser Support

  • This API is supported in at least two major browser engines (not two Chromium-based browsers).

Have Tried The Latest Releases

  • This issue applies to the latest release of TypeScript.
  • This issue applies to the latest release of @types/web.

Additional Context

I cannot tell if this was done intentionally -- one could argue that this global variable easily leads to errors. Still, it probably should not be marked as "deprecated", as this is an accuracy issue.

This is also not marked as deprecated in browser-compat-data: https://github.com/mdn/browser-compat-data/blob/2a7efce6061671a19c149b3aca17480989139f6f/api/Window.json#L3383

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions