From 7b783bc739788850d29d9f2b6398deaff00b9b7f Mon Sep 17 00:00:00 2001 From: andy Date: Sun, 10 Mar 2019 18:01:33 -0600 Subject: [PATCH] feat: drop `Diff` in favor of `Exclude` We don't need `Diff` any longer since `Exclude` exists (and has for a while). `Diff` is just a wrapper over `Exclude` now anyways. BREAKING CHANGE: `Diff` is no longer exported from simplytyped. Can find and replace `Diff` for `Exclude` to maintain same functionality. --- src/types/objects.ts | 3 +-- src/types/strings.ts | 9 +++------ test/strings/Diff.test.ts | 15 --------------- 3 files changed, 4 insertions(+), 23 deletions(-) delete mode 100644 test/strings/Diff.test.ts diff --git a/src/types/objects.ts b/src/types/objects.ts index 67a4e42..bfdfdf0 100644 --- a/src/types/objects.ts +++ b/src/types/objects.ts @@ -1,4 +1,3 @@ -import { Diff } from './strings'; import { False, True } from './conditionals'; import { AnyFunc } from './functions'; @@ -127,7 +126,7 @@ export type UnionizeProperties = T[Keys]; * @param K the union of keys to remove from `T` * @returns `T` with the keys `K` removed */ -export type Omit> = Pick, K>>; +export type Omit> = Pick, K>>; /** * Returns only the shared properties between two objects. * All shared properties must be the same type. diff --git a/src/types/strings.ts b/src/types/strings.ts index 8c58e4d..79469ba 100644 --- a/src/types/strings.ts +++ b/src/types/strings.ts @@ -1,15 +1,12 @@ import { True, False, And } from './conditionals'; import { IsNever } from './predicates'; -// TODO: this is here only for backwards compatibility -export type Diff = Exclude; - -export type DropString = Diff; +export type DropString = Exclude; export type StringEqual = And< - IsNever>, - IsNever> + IsNever>, + IsNever> >; export type UnionContains = U extends T ? True : False; diff --git a/test/strings/Diff.test.ts b/test/strings/Diff.test.ts deleted file mode 100644 index 1c729aa..0000000 --- a/test/strings/Diff.test.ts +++ /dev/null @@ -1,15 +0,0 @@ -import test from 'ava'; -import { assert } from '../helpers/assert'; - -import { Diff } from '../../src'; - -test('Can get difference between unions of strings', t => { - type a = 'hi' | 'there'; - type b = 'hi' | 'my' | 'friend'; - - type gotA = Diff; - type gotB = Diff; - - assert(t); - assert(t); -});