-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
41 changed files
with
3,442 additions
and
1,598 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,24 @@ | ||
node_modules | ||
.vscode | ||
package.json | ||
/node_modules | ||
/coverage | ||
/.idea | ||
/.circleci | ||
/.husky | ||
/.DS_Store | ||
/.nyc_output | ||
/.github | ||
/*.md | ||
|
||
# IDEs and editors | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
{ | ||
"printWidth": 120, | ||
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"proseWrap": "always" | ||
"arrowParens": "avoid", | ||
"trailingComma": "all" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export default { | ||
testEnvironment: 'node', | ||
verbose: true, | ||
maxWorkers: '50%', | ||
testMatch: ['<rootDir>/test/**/*.spec.ts'], | ||
transform: { | ||
'^.+\\.m?[tj]sx?$': [ | ||
'ts-jest', | ||
{ | ||
tsconfig: '<rootDir>/tsconfig.json', | ||
}, | ||
], | ||
}, | ||
transformIgnorePatterns: ['node_modules'], | ||
moduleNameMapper: { | ||
'^(\\.{1,2}/.*)\\.js$': '$1', | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export default { | ||
testEnvironment: 'node', | ||
verbose: true, | ||
maxWorkers: '50%', | ||
testMatch: ['<rootDir>/test/**/*.spec.ts'], | ||
transform: { | ||
'^.+.ts?$': [ | ||
'ts-jest', | ||
{ | ||
tsconfig: '<rootDir>/tsconfig-nostrict.json', | ||
}, | ||
], | ||
}, | ||
moduleNameMapper: { | ||
'(\\..+)\\.js': '$1', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/** | ||
* Merges types without merging types of properties. | ||
*/ | ||
export type Combine<T1, T2, T3 = {}, T4 = {}> = T1 | ||
& Omit<T2, keyof T1> | ||
& Omit<T3, keyof T1 | keyof T2> | ||
& Omit<T4, keyof T1 | keyof T2 | keyof T3>; | ||
export type Combine<T1, T2, T3 = {}, T4 = {}> = T1 & | ||
Omit<T2, keyof T1> & | ||
Omit<T3, keyof T1 | keyof T2> & | ||
Omit<T4, keyof T1 | keyof T2 | keyof T3>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const noOp = x => x; | ||
|
||
module.exports = { | ||
asMutable: noOp, | ||
asDeepMutable: noOp, | ||
asDeeperMutable: noOp, | ||
asReadonly: noOp, | ||
asDeepReadonly: noOp, | ||
asDeeperReadonly: noOp, | ||
asPartial: noOp, | ||
asDeepPartial: noOp, | ||
asDeeperPartial: noOp, | ||
asRequired: noOp, | ||
asDeepRequired: noOp, | ||
asDeeperRequired: noOp, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,61 @@ | ||
export * from "./combine"; | ||
export * from "./dto"; | ||
export * from "./helpers"; | ||
export * from "./logical.js"; | ||
export * from "./mutable"; | ||
export * from "./nullish"; | ||
export * from "./omit"; | ||
export * from "./omit-never"; | ||
export * from "./opaque"; | ||
export * from "./partial"; | ||
export * from "./pick"; | ||
export * from "./readonly"; | ||
export * from "./required"; | ||
export * from "./type-check"; | ||
export * from "./types"; | ||
// noinspection JSUnusedGlobalSymbols | ||
|
||
import { DeeperMutable, DeepMutable, Mutable } from './mutable'; | ||
import { DeeperPartial, DeepPartial } from './partial'; | ||
import { DeeperReadonly, DeepReadonly } from './readonly'; | ||
import { DeeperRequired, DeepRequired } from './required'; | ||
|
||
export * from './combine'; | ||
export * from './dto'; | ||
export * from './helpers'; | ||
export * from './logical'; | ||
export * from './mutable'; | ||
export * from './nullish'; | ||
export * from './omit'; | ||
export * from './omit-never'; | ||
export * from './opaque'; | ||
export * from './partial'; | ||
export * from './pick'; | ||
export * from './readonly'; | ||
export * from './required'; | ||
export * from './type-check'; | ||
export * from './types'; | ||
|
||
declare function asMutable<T>(x: T): Mutable<T>; | ||
|
||
declare function asDeepMutable<T>(x: T): DeepMutable<T>; | ||
|
||
declare function asDeeperMutable<T>(x: T): DeeperMutable<T>; | ||
|
||
declare function asReadonly<T>(x: T): Readonly<T>; | ||
|
||
declare function asDeepReadonly<T>(x: T): DeepReadonly<T>; | ||
|
||
declare function asDeeperReadonly<T>(x: T): DeeperReadonly<T>; | ||
|
||
declare function asPartial<T>(x: T): Partial<T>; | ||
|
||
declare function asDeepPartial<T>(x: T): DeepPartial<T>; | ||
|
||
declare function asDeeperPartial<T>(x: T): DeeperPartial<T>; | ||
|
||
declare function asRequired<T>(x: T): Required<T>; | ||
|
||
declare function asDeepRequired<T>(x: T): DeepRequired<T>; | ||
|
||
declare function asDeeperRequired<T>(x: T): DeeperRequired<T>; | ||
|
||
export { | ||
asMutable, | ||
asDeepMutable, | ||
asDeeperMutable, | ||
asReadonly, | ||
asDeepReadonly, | ||
asDeeperReadonly, | ||
asPartial, | ||
asDeepPartial, | ||
asDeeperPartial, | ||
asRequired, | ||
asDeepRequired, | ||
asDeeperRequired, | ||
}; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const noOp = x => x; | ||
|
||
export { | ||
noOp as asMutable, | ||
noOp as asDeepMutable, | ||
noOp as asDeeperMutable, | ||
noOp as asReadonly, | ||
noOp as asDeepReadonly, | ||
noOp as asDeeperReadonly, | ||
noOp as asPartial, | ||
noOp as asDeepPartial, | ||
noOp as asDeeperPartial, | ||
noOp as asRequired, | ||
noOp as asDeepRequired, | ||
noOp as asDeeperRequired, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,31 @@ | ||
import { IfNever } from './type-check'; | ||
|
||
export type And<T1, T2, T3 = true, T4 = true, T5 = true, T6 = true> = | ||
IfNever<Exclude<T1, undefined | null | false>> extends true ? false : | ||
IfNever<Exclude<T2, undefined | null | false>> extends true ? false : | ||
IfNever<Exclude<T3, undefined | null | false>> extends true ? false : | ||
IfNever<Exclude<T4, undefined | null | false>> extends true ? false : | ||
IfNever<Exclude<T5, undefined | null | false>> extends true ? false : | ||
IfNever<Exclude<T6, undefined | null | false>> extends true ? false : | ||
true; | ||
IfNever<Exclude<T1, undefined | null | false>> extends true | ||
? false | ||
: IfNever<Exclude<T2, undefined | null | false>> extends true | ||
? false | ||
: IfNever<Exclude<T3, undefined | null | false>> extends true | ||
? false | ||
: IfNever<Exclude<T4, undefined | null | false>> extends true | ||
? false | ||
: IfNever<Exclude<T5, undefined | null | false>> extends true | ||
? false | ||
: IfNever<Exclude<T6, undefined | null | false>> extends true | ||
? false | ||
: true; | ||
|
||
export type Or<T1, T2, T3 = false, T4 = false, T5 = false, T6 = false> = | ||
IfNever<Exclude<T1, undefined | null | false>> extends false ? true : | ||
IfNever<Exclude<T2, undefined | null | false>> extends false ? true : | ||
IfNever<Exclude<T3, undefined | null | false>> extends false ? true : | ||
IfNever<Exclude<T4, undefined | null | false>> extends false ? true : | ||
IfNever<Exclude<T5, undefined | null | false>> extends false ? true : | ||
IfNever<Exclude<T6, undefined | null | false>> extends false ? true : | ||
false; | ||
IfNever<Exclude<T1, undefined | null | false>> extends false | ||
? true | ||
: IfNever<Exclude<T2, undefined | null | false>> extends false | ||
? true | ||
: IfNever<Exclude<T3, undefined | null | false>> extends false | ||
? true | ||
: IfNever<Exclude<T4, undefined | null | false>> extends false | ||
? true | ||
: IfNever<Exclude<T5, undefined | null | false>> extends false | ||
? true | ||
: IfNever<Exclude<T6, undefined | null | false>> extends false | ||
? true | ||
: false; |
Oops, something went wrong.