Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Commit

Permalink
remove useless ObjectExact
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed Jul 4, 2017
1 parent 0ffeb8c commit efc9244
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
**Note**: Gaps between patch versions are faulty/broken releases.
**Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice.

# 0.1.2

- **Bug Fix**
- remove `ObjectExact` (@gcanti)

# 0.1.1

- **New Feature**
- `PickExact` (@gcanti)
- `ObjectExact` (@gcanti)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typelevel-ts",
"version": "0.1.1",
"version": "0.1.2",
"description": "Type level programming in TypeScript",
"files": ["lib"],
"main": "lib/index.js",
Expand Down
2 changes: 0 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,3 @@ export type ObjectDiff<O1 extends O2, O2> = ObjectOmit<O1, keyof O2> & Partial<O
export type ObjectClean<T> = Pick<T, keyof T>

export type PickExact<O, K extends keyof O> = Pick<O, K> & { [K1 in StringOmit<keyof O, K>]?: never }

export type ObjectExact<O> = PickExact<O, keyof O>
9 changes: 0 additions & 9 deletions typings-checker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,3 @@ const e2: E1 = { c: 1, a: 'foo' }
const e3: E1 = { a: 'foo', b: true }
// $ExpectError Type 'number' is not assignable to type 'undefined'
const e4: E1 = { a: 'foo', b: true, c: 1 }

type E2 = t.ObjectExact<{ a: number; b?: number }>

const e5: E2 = { a: 1 }
// $ExpectError Object literal may only specify known properties, and 'c' does not exist in type 'PickExact<{ a: number; b?: number | undefined; }, "a" | "b">'
const e6: E2 = { a: 1, c: 1 }
const e7: E2 = { a: 1, b: 1 }
// $ExpectError Type 'string' is not assignable to type 'number | undefined'
const e8: E2 = { a: 1, b: 'foo' }

0 comments on commit efc9244

Please sign in to comment.