@halospv3/hce.shared-config
Version:
Automate commit message quality, changelogs, and CI/CD releases. Its `main` entry point is a Semantic Release config. Functions and classes are exposed for customization. An ESLint config, a Commitlint config, and addl. resources for .NET projects are als
18 lines (15 loc) • 619 B
TypeScript
/**
* ### `Exact<T, S>`
*
* [issue](https://github.com/microsoft/TypeScript/issues/12936#issuecomment-2816928183)\
* [author](https://github.com/ahrjarrett)\
* license: unlicensed[!]
* @see
* - {@link https://tsplay.dev/NnGG6m}
*/
export type Exact<T, S> = [keyof T] extends [keyof S]
? [T] extends [S] ? { [K in keyof T]: T[K] } : S
: { [K in keyof T as K extends keyof S ? never : K]: TypeError<`Excess: '${Coerce<K>}'`> };
interface TypeError<Message> { [' TypeError']: Message }
// prior art: use arktype's ^^^ leading whitespace trick to avoid collisions
type Coerce<T> = `${T & (string | number)}`;