diff --git a/src/Types/CommonKeys.ts b/src/Types/CommonKeys.ts index fc3bef7..0e24051 100644 --- a/src/Types/CommonKeys.ts +++ b/src/Types/CommonKeys.ts @@ -1,4 +1,4 @@ /** * Extracts the common keys between two types */ -export type CommonKeys = Extract +export type CommonKeys2 = Extract diff --git a/src/Types/Extend.ts b/src/Types/Extend.ts index 3cc12da..0adcd4f 100644 --- a/src/Types/Extend.ts +++ b/src/Types/Extend.ts @@ -1,4 +1,4 @@ -import type { CommonKeys } from "./CommonKeys" +import type { CommonKeys2 } from "./CommonKeys" export type Extend = ( @@ -7,9 +7,9 @@ export type Extend = ( infer Self, ...infer Rest extends readonly object[], ] - ? Pick> extends Pick> + ? Pick> extends Pick> ? Extend> & Self, + Omit> & Self, ...Rest, ]> : never @@ -18,6 +18,9 @@ export type Extend = ( : {} ) +export type Extend2 = Omit> & Self + + export type Override = ( T extends readonly [ infer Super, @@ -25,7 +28,7 @@ export type Override = ( ...infer Rest extends readonly object[], ] ? Override> & Self, + Omit> & Self, ...Rest, ]> : T extends readonly [infer Self] @@ -39,9 +42,9 @@ export type Extendable = ( infer Self, ...infer Rest extends readonly object[], ] - ? Pick> extends Pick> + ? Pick> extends Pick> ? Extendable> & Self, + Omit> & Self, ...Rest, ]> : false