mirror of
https://github.com/sindresorhus/type-fest.git
synced 2025-12-08 19:25:05 +00:00
18 lines
446 B
TypeScript
18 lines
446 B
TypeScript
import {expectType} from 'tsd';
|
|
import type {Except} from '../index';
|
|
|
|
declare const except: Except<{a: number; b: string}, 'b'>;
|
|
expectType<{a: number}>(except);
|
|
|
|
// Generic properties
|
|
type Example = {
|
|
[key: string]: unknown;
|
|
foo: number;
|
|
bar: string;
|
|
};
|
|
|
|
const test: Except<Example, 'bar'> = {foo: 123, bar: 'asdf'};
|
|
expectType<number>(test.foo);
|
|
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
expectType<unknown>(test['bar']);
|