Comparing version 0.0.13 to 0.0.14
@@ -14,2 +14,11 @@ export declare type nil = null | undefined; | ||
export declare type NonUndefined<T> = T extends undefined ? never : T; | ||
export declare type IsNonNil<T, True, False = never> = null extends T ? False : undefined extends T ? False : True; | ||
export declare type IsNilable<T, True, False = never> = null extends T ? True : undefined extends T ? True : False; | ||
export declare type IsNonNull<T, True, False = never> = null extends T ? False : True; | ||
export declare type IsNullable<T, True, False = never> = null extends T ? True : False; | ||
export declare type IsNonUndefined<T, True, False = never> = undefined extends T ? False : True; | ||
export declare type IsUndefinedable<T, True, False = never> = undefined extends T ? True : False; | ||
export declare type IsNever<T, True, False = never> = [T] extends [never] ? True : False; | ||
export declare type IsAny<T, True, False = never> = True | False extends (T extends never ? True : False) ? True : False; | ||
export declare type IsUnknown<T, True, False = never> = unknown extends T ? IsAny<T, False, True> : False; | ||
export declare type NilableProps<T> = { | ||
@@ -36,2 +45,26 @@ [P in keyof T]?: T[P] | nil; | ||
}; | ||
export declare type UndefinedableKeys<T> = Exclude<{ | ||
[K in keyof T]: IsUndefinedable<T[K], K>; | ||
}[keyof T], undefined>; | ||
export declare type NullableKeys<T> = Exclude<{ | ||
[K in keyof T]: IsNullable<T[K], K>; | ||
}[keyof T], undefined>; | ||
export declare type NilableKeys<T> = Exclude<{ | ||
[K in keyof T]: IsNilable<T[K], K>; | ||
}[keyof T], undefined>; | ||
export declare type NilableToNilableProps<T> = Omit<{ | ||
[P in keyof T]: T[P]; | ||
}, NilableKeys<T>> & Pick<{ | ||
[P in keyof T]?: T[P] | nil; | ||
}, NilableKeys<T>>; | ||
export declare type NilableToNullableProps<T> = Omit<{ | ||
[P in keyof T]: T[P]; | ||
}, NilableKeys<T>> & Pick<{ | ||
[P in keyof T]: NonUndefined<T[P]> | null; | ||
}, NilableKeys<T>>; | ||
export declare type NilableToOptionalProps<T> = Omit<{ | ||
[P in keyof T]: T[P]; | ||
}, NilableKeys<T>> & Pick<{ | ||
[P in keyof T]?: NonNull<T[P]> | undefined; | ||
}, NilableKeys<T>>; | ||
export declare type WritableProps<T> = { | ||
@@ -102,11 +135,5 @@ -readonly [P in keyof T]: T[P]; | ||
} & OverwriteProps<C2, C1>; | ||
export declare type IsNonNil<T, True, False = never> = null extends T ? False : undefined extends T ? False : True; | ||
export declare type IsNonNull<T, True, False = never> = null extends T ? False : True; | ||
export declare type IsNonUndefined<T, True, False = never> = undefined extends T ? False : True; | ||
export declare type IsNever<T, True, False = never> = [T] extends [never] ? True : False; | ||
export declare type IsAny<T, True, False = never> = (True | False) extends (T extends never ? True : False) ? True : False; | ||
export declare type IsUnknown<T, True, False = never> = unknown extends T ? IsAny<T, False, True> : False; | ||
export declare type StrictlyIncludes<T, U, True, False = never> = Exclude<U, T> extends never ? (IsAny<T, 1, 0> extends 1 ? True : (IsAny<U, 1, 0> extends 1 ? False : (IsUnknown<T, 1, 0> extends 1 ? IsUnknown<U, True, False> : True))) : False; | ||
export declare type StrictlyIncludes<T, U, True, False = never> = Exclude<U, T> extends never ? IsAny<T, 1, 0> extends 1 ? True : IsAny<U, 1, 0> extends 1 ? False : IsUnknown<T, 1, 0> extends 1 ? IsUnknown<U, True, False> : True : False; | ||
export declare type AreStrictlyEqual<T, U, True, False = never> = StrictlyIncludes<T, U, 1, 0> extends 1 ? StrictlyIncludes<U, T, True, False> : False; | ||
export declare type HaveSameKeys<T, U, True, False = never> = (Exclude<keyof T, keyof U> | Exclude<keyof U, keyof T>) extends never ? True : False; | ||
export declare type HaveSameKeys<T, U, True, False = never> = Exclude<keyof T, keyof U> | Exclude<keyof U, keyof T> extends never ? True : False; | ||
export declare type Exact<T, X extends T> = T & { | ||
@@ -113,0 +140,0 @@ [K in keyof X]: K extends keyof T ? X[K] : never; |
@@ -14,2 +14,11 @@ export declare type nil = null | undefined; | ||
export declare type NonUndefined<T> = T extends undefined ? never : T; | ||
export declare type IsNonNil<T, True, False = never> = null extends T ? False : undefined extends T ? False : True; | ||
export declare type IsNilable<T, True, False = never> = null extends T ? True : undefined extends T ? True : False; | ||
export declare type IsNonNull<T, True, False = never> = null extends T ? False : True; | ||
export declare type IsNullable<T, True, False = never> = null extends T ? True : False; | ||
export declare type IsNonUndefined<T, True, False = never> = undefined extends T ? False : True; | ||
export declare type IsUndefinedable<T, True, False = never> = undefined extends T ? True : False; | ||
export declare type IsNever<T, True, False = never> = [T] extends [never] ? True : False; | ||
export declare type IsAny<T, True, False = never> = True | False extends (T extends never ? True : False) ? True : False; | ||
export declare type IsUnknown<T, True, False = never> = unknown extends T ? IsAny<T, False, True> : False; | ||
export declare type NilableProps<T> = { | ||
@@ -36,2 +45,26 @@ [P in keyof T]?: T[P] | nil; | ||
}; | ||
export declare type UndefinedableKeys<T> = Exclude<{ | ||
[K in keyof T]: IsUndefinedable<T[K], K>; | ||
}[keyof T], undefined>; | ||
export declare type NullableKeys<T> = Exclude<{ | ||
[K in keyof T]: IsNullable<T[K], K>; | ||
}[keyof T], undefined>; | ||
export declare type NilableKeys<T> = Exclude<{ | ||
[K in keyof T]: IsNilable<T[K], K>; | ||
}[keyof T], undefined>; | ||
export declare type NilableToNilableProps<T> = Omit<{ | ||
[P in keyof T]: T[P]; | ||
}, NilableKeys<T>> & Pick<{ | ||
[P in keyof T]?: T[P] | nil; | ||
}, NilableKeys<T>>; | ||
export declare type NilableToNullableProps<T> = Omit<{ | ||
[P in keyof T]: T[P]; | ||
}, NilableKeys<T>> & Pick<{ | ||
[P in keyof T]: NonUndefined<T[P]> | null; | ||
}, NilableKeys<T>>; | ||
export declare type NilableToOptionalProps<T> = Omit<{ | ||
[P in keyof T]: T[P]; | ||
}, NilableKeys<T>> & Pick<{ | ||
[P in keyof T]?: NonNull<T[P]> | undefined; | ||
}, NilableKeys<T>>; | ||
export declare type WritableProps<T> = { | ||
@@ -102,11 +135,5 @@ -readonly [P in keyof T]: T[P]; | ||
} & OverwriteProps<C2, C1>; | ||
export declare type IsNonNil<T, True, False = never> = null extends T ? False : undefined extends T ? False : True; | ||
export declare type IsNonNull<T, True, False = never> = null extends T ? False : True; | ||
export declare type IsNonUndefined<T, True, False = never> = undefined extends T ? False : True; | ||
export declare type IsNever<T, True, False = never> = [T] extends [never] ? True : False; | ||
export declare type IsAny<T, True, False = never> = (True | False) extends (T extends never ? True : False) ? True : False; | ||
export declare type IsUnknown<T, True, False = never> = unknown extends T ? IsAny<T, False, True> : False; | ||
export declare type StrictlyIncludes<T, U, True, False = never> = Exclude<U, T> extends never ? (IsAny<T, 1, 0> extends 1 ? True : (IsAny<U, 1, 0> extends 1 ? False : (IsUnknown<T, 1, 0> extends 1 ? IsUnknown<U, True, False> : True))) : False; | ||
export declare type StrictlyIncludes<T, U, True, False = never> = Exclude<U, T> extends never ? IsAny<T, 1, 0> extends 1 ? True : IsAny<U, 1, 0> extends 1 ? False : IsUnknown<T, 1, 0> extends 1 ? IsUnknown<U, True, False> : True : False; | ||
export declare type AreStrictlyEqual<T, U, True, False = never> = StrictlyIncludes<T, U, 1, 0> extends 1 ? StrictlyIncludes<U, T, True, False> : False; | ||
export declare type HaveSameKeys<T, U, True, False = never> = (Exclude<keyof T, keyof U> | Exclude<keyof U, keyof T>) extends never ? True : False; | ||
export declare type HaveSameKeys<T, U, True, False = never> = Exclude<keyof T, keyof U> | Exclude<keyof U, keyof T> extends never ? True : False; | ||
export declare type Exact<T, X extends T> = T & { | ||
@@ -113,0 +140,0 @@ [K in keyof X]: K extends keyof T ? X[K] : never; |
{ | ||
"name": "tsdef", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "TypeScript common pattern shortcut definitions / utility gist library", | ||
@@ -40,3 +40,3 @@ "keywords": [ | ||
"precommit": "npm run all", | ||
"prepublish": "npm run all", | ||
"prepublishOnly": "npm run all", | ||
"reinstall": "rm -rf ./node_modules ./package-lock.json ./yarn.lock && yarn", | ||
@@ -51,15 +51,15 @@ "start": "npm run test", | ||
"devDependencies": { | ||
"@types/jest": "^24.0.15", | ||
"@types/node": "^12.0.10", | ||
"coveralls": "^3.0.4", | ||
"jest": "^24.8.0", | ||
"@types/jest": "^26.0.8", | ||
"@types/node": "^14.0.27", | ||
"coveralls": "^3.1.0", | ||
"jest": "^26.2.2", | ||
"pre-commit": "^1.2.2", | ||
"prettier": "^1.18.2", | ||
"ts-jest": "^24.0.2", | ||
"prettier": "^2.0.5", | ||
"ts-jest": "^26.1.4", | ||
"tscpaths": "^0.0.9", | ||
"tslint": "^5.18.0", | ||
"tslint-config-airbnb": "^5.11.1", | ||
"tslint": "^6.1.3", | ||
"tslint-config-airbnb": "^5.11.2", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^3.5.2" | ||
"typescript": "^3.9.7" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47038
278
32324