@ekb1zh/type
Version:
Simple tool for getting data type
27 lines (23 loc) • 506 B
text/typescript
import { typeOf, Kind } from './'
test('typeOf', () => {
const values: [unknown, Kind][] = [
[false, 'boolean'],
[0, 'number'],
['', 'string'],
[Symbol(), 'symbol'],
[BigInt('0'), 'bigint'],
[{}, 'object'],
[[], 'array'],
[() => {}, 'function'],
[null, 'null'],
[void 0, 'undefined'],
]
values.forEach(([value, kind]) => {
const type = typeOf(value)
expect(type).toBe(kind)
})
})
test('Kind', () => {
const kind: Kind = 'null'
expect(kind)
})