Skip to content
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

navigator.hardwareConcurrency not existing #11581

Closed
nicolashenry opened this issue Oct 13, 2016 · 1 comment
Closed

navigator.hardwareConcurrency not existing #11581

nicolashenry opened this issue Oct 13, 2016 · 1 comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue

Comments

@nicolashenry
Copy link

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'.

@kitsonk
Copy link
Contributor

kitsonk commented Oct 13, 2016

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.

@mhegazy mhegazy added Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript labels Oct 13, 2016
@mhegazy mhegazy added this to the TypeScript 2.1 milestone Oct 13, 2016
@mhegazy mhegazy reopened this Oct 13, 2016
@mhegazy mhegazy added Fixed in TSJS repo Fix merged in https://github.com/Microsoft/TSJS-lib-generator, but not ported yet and removed Fixed in TSJS repo labels Oct 21, 2016
@mhegazy mhegazy modified the milestones: TypeScript 2.1, TypeScript 2.1.2 Oct 27, 2016
@mhegazy mhegazy added Fixed A PR has been merged for this issue and removed Fixed in TSJS repo Fix merged in https://github.com/Microsoft/TSJS-lib-generator, but not ported yet labels Oct 31, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants