Skip to content

Commit

Permalink
test(types): stub
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Apr 24, 2024
1 parent 9f1f7be commit c9cdff1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/patterns/test/types.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { Passable } from '@endo/pass-style';
import { expectNotType, expectType } from 'tsd';
import { isKey } from '../src/keys/checkKey.js';
import { M } from '../src/patterns/patternMatchers.js';
import type { Key } from '../src/types.js';

// @ts-expect-error M.any missing parens
M.arrayOf(M.any);
M.arrayOf(M.any());

{
const maybeKey: Passable = 'key';
const result = isKey(maybeKey);
expectType<boolean>(result);
if (result) {
expectType<Key>(maybeKey);
} else {
expectNotType<Key>(maybeKey);
}
}

0 comments on commit c9cdff1

Please sign in to comment.