镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

navigator.hardwareConcurrency not existing #11581

Description

TypeScript Version: 2.0.3

Code

const hardwareConcurrency = window.navigator.hardwareConcurrency;

Expected behavior:
No error

Actual behavior:
[ts] Property 'hardwareConcurrency' does not exist on type 'Navigator'.

Activity

  1. kitsonk commented on Oct 13, 2016

    @kitsonk
    Contributor

    While this is part of the living standard, it doesn't have wide browser support. Interfaces are open ended though and it is quite easy to add this:

    interface Navigator {
        hardwareConcurrency: number;
    }
    
    const hardwareConcurrency = window.navigator.hardwareConcurrency; // no error

    If you do feel that it is more widely supported, the lib.webworker.d.ts is generated via TSJS-lib-generator where I suspect a contribution would be welcomed.

  2. modified the milestones: TypeScript 2.1, on Oct 27, 2016
  3. added
    FixedA PR has been merged for this issue
    and removed
    Fixed in TSJS repoFix merged in https://github.com/Microsoft/TSJS-lib-generator, but not ported yet
    on Oct 31, 2016
  4. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions