feat: Add has‑symbols (#44917)

This commit is contained in:
ExE Boss 2020-05-21 20:38:05 +02:00 committed by GitHub
parent f56bdcfc32
commit 281fd86039
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,5 @@
import hasNativeSymbols = require('has-symbols');
import hasSymbolSham = require('has-symbols/shams');
hasNativeSymbols(); // $ExpectType boolean
hasSymbolSham(); // $ExpectType boolean

13
types/has-symbols/index.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
// Type definitions for has-symbols 1.0
// Project: https://github.com/ljharb/has-symbols#readme
// Definitions by: Jordan Harband <https://github.com/ljharb>
// ExE Boss <https://github.com/ExE-Boss>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Returns `true` only if the environment has native `Symbol` support.
*
* Not polyfillable, not forgeable.
*/
declare function hasNativeSymbols(): boolean;
export = hasNativeSymbols;

6
types/has-symbols/shams.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
/**
* Returns `true` if the environment has a `Symbol` sham
* that mostly follows the spec.
*/
declare function hasSymbolSham(): boolean;
export = hasSymbolSham;

View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["ES2015"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"has-symbols-tests.ts",
"index.d.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }