How to use the tsd.expectNotAssignable function in tsd

To help you get started, we’ve selected a few tsd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fregante / webext-storage-cache / index.test-d.ts View on Github external
import {expectType, expectNotAssignable, expectAssignable} from 'tsd';
import cache from '.';

type Primitive = boolean | number | string;
type Value = Primitive | Primitive[] | Record;

expectType>(cache.has('key'));
expectType>(cache.delete('key'));

expectType>(cache.get('key'));
expectType>(cache.get('key'));
expectNotAssignable>(cache.get('key'));

expectAssignable>(cache.set('key', 1));
expectAssignable>(cache.set('key', true));
expectAssignable>(cache.set('key', [true, 'string']));
expectAssignable>>(cache.set('key', {wow: [true, 'string']}));
expectAssignable>(cache.set('key', 1, 1));

tsd

Check TypeScript type definitions

MIT
Latest version published 4 months ago

Package Health Score

80 / 100
Full package analysis