Skip to content
14 changes: 14 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import * as Npm from './npm';

export {Npm};

// TODO: Add more examples

// TODO: This can just be `export type Primitive = not object` when the `not` keyword is out.
Expand Down Expand Up @@ -84,3 +88,13 @@ const ab: Merge<Foo, Bar> = {a: 1, b: 2};
```
*/
export type Merge<FirstType, SecondType> = Omit<FirstType, Extract<keyof FirstType, keyof SecondType>> & SecondType;

/**
This type is a workaround for the TypeScript issue https://github.com/Microsoft/TypeScript/issues/29729.

It will be removed as soon as it's not needed any more.
*/
export type LiteralUnion<
LiteralType extends BaseType,
BaseType extends Primitive
> = LiteralType | (BaseType & {_?: never});
1 change: 1 addition & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable import/no-unassigned-import */
import './test/omit';
import './test/merge';
import './test/npm';

// TODO: Add negative tests. Blocked by: https://github.com/SamVerschueren/tsd-check/issues/2
Loading