type-plus 3.15.0 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -55
- package/cjs/array/index.d.ts +17 -17
- package/cjs/array/index.js +5 -18
- package/cjs/array/index.js.map +1 -1
- package/cjs/assertion/index.js +5 -1
- package/cjs/assertion/index.js.map +1 -1
- package/cjs/class/index.d.ts +1 -1
- package/cjs/class/index.js +5 -2
- package/cjs/class/index.js.map +1 -1
- package/cjs/function/index.d.ts +1 -1
- package/cjs/function/index.js +0 -11
- package/cjs/function/index.js.map +1 -1
- package/cjs/functional/index.d.ts +1 -1
- package/cjs/functional/index.js +0 -12
- package/cjs/functional/index.js.map +1 -1
- package/cjs/index.d.ts +3 -7
- package/cjs/index.js +8 -22
- package/cjs/index.js.map +1 -1
- package/cjs/math/index.d.ts +7 -7
- package/cjs/math/index.js +0 -17
- package/cjs/math/index.js.map +1 -1
- package/cjs/nodejs/index.js +5 -1
- package/cjs/nodejs/index.js.map +1 -1
- package/cjs/nominal-types/index.js +5 -1
- package/cjs/nominal-types/index.js.map +1 -1
- package/cjs/object/index.d.ts +18 -18
- package/cjs/object/index.js +5 -19
- package/cjs/object/index.js.map +1 -1
- package/cjs/predicates/CanAssign.d.ts +1 -1
- package/cjs/predicates/{isEmptyObject.d.ts → IsEmptyObject.d.ts} +0 -0
- package/cjs/{types/AllType.js → predicates/IsEmptyObject.js} +1 -1
- package/cjs/predicates/IsEmptyObject.js.map +1 -0
- package/cjs/predicates/index.d.ts +5 -5
- package/cjs/predicates/index.js +5 -6
- package/cjs/predicates/index.js.map +1 -1
- package/cjs/promise/index.d.ts +2 -2
- package/cjs/promise/index.js +5 -3
- package/cjs/promise/index.js.map +1 -1
- package/cjs/utils/index.d.ts +1 -1
- package/cjs/utils/index.js +5 -2
- package/cjs/utils/index.js.map +1 -1
- package/esm/array/index.js +0 -17
- package/esm/array/index.js.map +1 -1
- package/esm/class/index.js +0 -1
- package/esm/class/index.js.map +1 -1
- package/esm/function/index.js +1 -1
- package/esm/function/index.js.map +1 -1
- package/esm/functional/index.js +1 -2
- package/esm/functional/index.js.map +1 -1
- package/esm/index.js +2 -7
- package/esm/index.js.map +1 -1
- package/esm/math/index.js +1 -7
- package/esm/math/index.js.map +1 -1
- package/esm/object/index.js +0 -18
- package/esm/object/index.js.map +1 -1
- package/esm/predicates/IsEmptyObject.js +2 -0
- package/esm/predicates/IsEmptyObject.js.map +1 -0
- package/esm/predicates/index.js +0 -5
- package/esm/predicates/index.js.map +1 -1
- package/esm/promise/index.js +0 -2
- package/esm/promise/index.js.map +1 -1
- package/esm/utils/index.js +0 -1
- package/esm/utils/index.js.map +1 -1
- package/package.json +20 -18
- package/ts/array/index.ts +19 -19
- package/ts/binary/_binary.ts +1 -1
- package/ts/class/index.ts +1 -1
- package/ts/function/index.ts +1 -1
- package/ts/functional/ChainFn.ts +6 -6
- package/ts/functional/index.ts +2 -2
- package/ts/index.spec.ts +6 -4
- package/ts/index.ts +7 -7
- package/ts/math/index.ts +7 -7
- package/ts/object/Partial.spec.ts +49 -49
- package/ts/object/index.ts +35 -35
- package/ts/predicates/CanAssign.ts +1 -1
- package/ts/predicates/{isEmptyObject.spec.ts → IsEmptyObject.spec.ts} +0 -0
- package/ts/predicates/{isEmptyObject.ts → IsEmptyObject.ts} +0 -0
- package/ts/predicates/index.ts +17 -17
- package/ts/promise/index.ts +2 -2
- package/ts/type-checker/typeChecker.spec.ts +2 -1
- package/ts/types/check.spec.ts +1 -1
- package/ts/types/conform.spec.ts +1 -1
- package/ts/types/index.ts +28 -28
- package/ts/types/satisfy.accept.ts +39 -38
- package/ts/types/satisfy.spec.ts +2 -1
- package/ts/utils/index.ts +2 -2
- package/cjs/predicates/isEmptyObject.js +0 -3
- package/cjs/predicates/isEmptyObject.js.map +0 -1
- package/cjs/types/AllType.d.ts +0 -18
- package/cjs/types/AllType.js.map +0 -1
- package/cjs/types/Any.d.ts +0 -6
- package/cjs/types/Any.js +0 -5
- package/cjs/types/Any.js.map +0 -1
- package/cjs/types/Array.d.ts +0 -28
- package/cjs/types/Array.js +0 -30
- package/cjs/types/Array.js.map +0 -1
- package/cjs/types/Boolean.d.ts +0 -29
- package/cjs/types/Boolean.js +0 -28
- package/cjs/types/Boolean.js.map +0 -1
- package/cjs/types/Generate.d.ts +0 -32
- package/cjs/types/Generate.js +0 -3
- package/cjs/types/Generate.js.map +0 -1
- package/cjs/types/Null.d.ts +0 -8
- package/cjs/types/Null.js +0 -10
- package/cjs/types/Null.js.map +0 -1
- package/cjs/types/Number.d.ts +0 -36
- package/cjs/types/Number.js +0 -50
- package/cjs/types/Number.js.map +0 -1
- package/cjs/types/Object.d.ts +0 -313
- package/cjs/types/Object.js +0 -35
- package/cjs/types/Object.js.map +0 -1
- package/cjs/types/Record.d.ts +0 -16
- package/cjs/types/Record.js +0 -17
- package/cjs/types/Record.js.map +0 -1
- package/cjs/types/String.d.ts +0 -36
- package/cjs/types/String.js +0 -51
- package/cjs/types/String.js.map +0 -1
- package/cjs/types/Symbol.d.ts +0 -8
- package/cjs/types/Symbol.js +0 -13
- package/cjs/types/Symbol.js.map +0 -1
- package/cjs/types/Tuple.d.ts +0 -35
- package/cjs/types/Tuple.js +0 -43
- package/cjs/types/Tuple.js.map +0 -1
- package/cjs/types/Undefined.d.ts +0 -6
- package/cjs/types/Undefined.js +0 -5
- package/cjs/types/Undefined.js.map +0 -1
- package/cjs/types/Union.d.ts +0 -20
- package/cjs/types/Union.js +0 -52
- package/cjs/types/Union.js.map +0 -1
- package/cjs/types/Unknown.d.ts +0 -6
- package/cjs/types/Unknown.js +0 -5
- package/cjs/types/Unknown.js.map +0 -1
- package/cjs/types/analyze.d.ts +0 -13
- package/cjs/types/analyze.js +0 -159
- package/cjs/types/analyze.js.map +0 -1
- package/cjs/types/check.d.ts +0 -14
- package/cjs/types/check.js +0 -25
- package/cjs/types/check.js.map +0 -1
- package/cjs/types/conform.d.ts +0 -15
- package/cjs/types/conform.js +0 -26
- package/cjs/types/conform.js.map +0 -1
- package/cjs/types/getPlainAnalysisReport.d.ts +0 -2
- package/cjs/types/getPlainAnalysisReport.js +0 -120
- package/cjs/types/getPlainAnalysisReport.js.map +0 -1
- package/cjs/types/index.d.ts +0 -26
- package/cjs/types/index.js +0 -45
- package/cjs/types/index.js.map +0 -1
- package/cjs/types/optional.d.ts +0 -328
- package/cjs/types/optional.js +0 -33
- package/cjs/types/optional.js.map +0 -1
- package/cjs/types/required.d.ts +0 -664
- package/cjs/types/required.js +0 -33
- package/cjs/types/required.js.map +0 -1
- package/cjs/types/satisfy.d.ts +0 -15
- package/cjs/types/satisfy.js +0 -26
- package/cjs/types/satisfy.js.map +0 -1
- package/cjs/types/types.d.ts +0 -9
- package/cjs/types/types.js +0 -3
- package/cjs/types/types.js.map +0 -1
- package/esm/predicates/isEmptyObject.js +0 -2
- package/esm/predicates/isEmptyObject.js.map +0 -1
- package/esm/types/AllType.js +0 -2
- package/esm/types/AllType.js.map +0 -1
- package/esm/types/Any.js +0 -2
- package/esm/types/Any.js.map +0 -1
- package/esm/types/Array.js +0 -27
- package/esm/types/Array.js.map +0 -1
- package/esm/types/Boolean.js +0 -25
- package/esm/types/Boolean.js.map +0 -1
- package/esm/types/Generate.js +0 -2
- package/esm/types/Generate.js.map +0 -1
- package/esm/types/Null.js +0 -7
- package/esm/types/Null.js.map +0 -1
- package/esm/types/Number.js +0 -30
- package/esm/types/Number.js.map +0 -1
- package/esm/types/Object.js +0 -31
- package/esm/types/Object.js.map +0 -1
- package/esm/types/Record.js +0 -14
- package/esm/types/Record.js.map +0 -1
- package/esm/types/String.js +0 -31
- package/esm/types/String.js.map +0 -1
- package/esm/types/Symbol.js +0 -10
- package/esm/types/Symbol.js.map +0 -1
- package/esm/types/Tuple.js +0 -23
- package/esm/types/Tuple.js.map +0 -1
- package/esm/types/Undefined.js +0 -2
- package/esm/types/Undefined.js.map +0 -1
- package/esm/types/Union.js +0 -32
- package/esm/types/Union.js.map +0 -1
- package/esm/types/Unknown.js +0 -2
- package/esm/types/Unknown.js.map +0 -1
- package/esm/types/analyze.js +0 -142
- package/esm/types/analyze.js.map +0 -1
- package/esm/types/check.js +0 -21
- package/esm/types/check.js.map +0 -1
- package/esm/types/conform.js +0 -22
- package/esm/types/conform.js.map +0 -1
- package/esm/types/getPlainAnalysisReport.js +0 -106
- package/esm/types/getPlainAnalysisReport.js.map +0 -1
- package/esm/types/index.js +0 -28
- package/esm/types/index.js.map +0 -1
- package/esm/types/optional.js +0 -30
- package/esm/types/optional.js.map +0 -1
- package/esm/types/required.js +0 -30
- package/esm/types/required.js.map +0 -1
- package/esm/types/satisfy.js +0 -22
- package/esm/types/satisfy.js.map +0 -1
- package/esm/types/types.js +0 -2
- package/esm/types/types.js.map +0 -1
|
File without changes
|
|
File without changes
|
package/ts/predicates/index.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export * from './CanAssign'
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export * from './isType'
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
import { IsExtend } from './Extends'
|
|
10
|
-
|
|
11
|
-
export type IsLiteral<T extends number | string, Then = true, Else = false> = number extends T ?
|
|
12
|
-
Else :
|
|
13
|
-
string extends T ? Else : Then
|
|
14
|
-
|
|
15
|
-
export type IsBoolean<T, Then = true, Else = false> = boolean extends T ? Then : Else
|
|
16
|
-
|
|
17
|
-
export type IsAny<T, Then = true, Else = false> = boolean extends IsExtend<T, string> ? Then : Else
|
|
1
|
+
export * from './CanAssign'
|
|
2
|
+
export type { Equal, IsEqual, IsNotEqual, NotEqual } from './Equal'
|
|
3
|
+
export type { Extendable, IsExtend, IsNotExtend, NotExtendable } from './Extends'
|
|
4
|
+
export type { If } from './If'
|
|
5
|
+
export * from './isType'
|
|
6
|
+
export type { And, Not, Or, Xor } from './logical'
|
|
7
|
+
export type { IsEmptyObject } from './IsEmptyObject'
|
|
8
|
+
|
|
9
|
+
import { IsExtend } from './Extends'
|
|
10
|
+
|
|
11
|
+
export type IsLiteral<T extends number | string, Then = true, Else = false> = number extends T ?
|
|
12
|
+
Else :
|
|
13
|
+
string extends T ? Else : Then
|
|
14
|
+
|
|
15
|
+
export type IsBoolean<T, Then = true, Else = false> = boolean extends T ? Then : Else
|
|
16
|
+
|
|
17
|
+
export type IsAny<T, Then = true, Else = false> = boolean extends IsExtend<T, string> ? Then : Else
|
package/ts/promise/index.ts
CHANGED
package/ts/types/check.spec.ts
CHANGED
package/ts/types/conform.spec.ts
CHANGED
package/ts/types/index.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A turing complete solution inspired by many.
|
|
3
|
-
* The types is in Pascal Cases
|
|
4
|
-
* because lower case type names (e.g. true) is a reserved keyword.
|
|
5
|
-
* https://github.com/microsoft/TypeScript/issues/14833
|
|
6
|
-
* https://github.com/tycho01/typical
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
// export * from './BigInt'
|
|
10
|
-
export
|
|
11
|
-
export * from './Any'
|
|
12
|
-
export * from './Array'
|
|
13
|
-
export * from './Boolean'
|
|
14
|
-
export * from './check'
|
|
15
|
-
export * from './conform'
|
|
16
|
-
export
|
|
17
|
-
export { nil as null, Null } from './Null'
|
|
18
|
-
export * from './Number'
|
|
19
|
-
export { keys, object, ObjectType as Object } from './Object'
|
|
20
|
-
export * from './Record'
|
|
21
|
-
export * from './satisfy'
|
|
22
|
-
export * from './String'
|
|
23
|
-
export * from './Symbol'
|
|
24
|
-
export * from './Tuple'
|
|
25
|
-
export * from './types'
|
|
26
|
-
export { undef as undefined, Undefined } from './Undefined'
|
|
27
|
-
export * from './Union'
|
|
28
|
-
export * from './Unknown'
|
|
1
|
+
/**
|
|
2
|
+
* A turing complete solution inspired by many.
|
|
3
|
+
* The types is in Pascal Cases
|
|
4
|
+
* because lower case type names (e.g. true) is a reserved keyword.
|
|
5
|
+
* https://github.com/microsoft/TypeScript/issues/14833
|
|
6
|
+
* https://github.com/tycho01/typical
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// export * from './BigInt'
|
|
10
|
+
export type { AllType } from './AllType'
|
|
11
|
+
export * from './Any'
|
|
12
|
+
export * from './Array'
|
|
13
|
+
export * from './Boolean'
|
|
14
|
+
export * from './check'
|
|
15
|
+
export * from './conform'
|
|
16
|
+
export type { Generate } from './Generate'
|
|
17
|
+
export { nil as null, Null } from './Null'
|
|
18
|
+
export * from './Number'
|
|
19
|
+
export { keys, object, ObjectType as Object } from './Object'
|
|
20
|
+
export * from './Record'
|
|
21
|
+
export * from './satisfy'
|
|
22
|
+
export * from './String'
|
|
23
|
+
export * from './Symbol'
|
|
24
|
+
export * from './Tuple'
|
|
25
|
+
export * from './types'
|
|
26
|
+
export { undef as undefined, Undefined } from './Undefined'
|
|
27
|
+
export * from './Union'
|
|
28
|
+
export * from './Unknown'
|
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
import { baseline } from '@unional/fixture'
|
|
2
|
-
import fs from 'fs'
|
|
3
|
-
import path from 'path'
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
})
|
|
1
|
+
import { baseline } from '@unional/fixture'
|
|
2
|
+
import fs from 'fs'
|
|
3
|
+
import path from 'path'
|
|
4
|
+
import * as T from '.'
|
|
5
|
+
import { O } from './optional'
|
|
6
|
+
|
|
7
|
+
const eslint = T.object.create({
|
|
8
|
+
env: O.object.create({
|
|
9
|
+
es6: O.boolean
|
|
10
|
+
}),
|
|
11
|
+
parseOptions: O.object.create({
|
|
12
|
+
ecmaVersion: O.number.list(3, 5, 6, 7, 8, 9, 10, 11, 12),
|
|
13
|
+
sourceType: O.string.list('script', 'module'),
|
|
14
|
+
ecmaFeatures: O.object.create({
|
|
15
|
+
globalReturn: O.boolean,
|
|
16
|
+
impliedStrict: O.boolean,
|
|
17
|
+
jsx: O.boolean
|
|
18
|
+
})
|
|
19
|
+
}),
|
|
20
|
+
plugins: O.array.create(O.string),
|
|
21
|
+
overrides: O.array.create(
|
|
22
|
+
T.object.create({
|
|
23
|
+
files: O.array.create(O.string),
|
|
24
|
+
processor: O.string,
|
|
25
|
+
rules: O.record.create(O.string.create('error'))
|
|
26
|
+
})
|
|
27
|
+
),
|
|
28
|
+
rules: O.record.create(O.string.create('error'))
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
baseline('fixtures/eslint', ({ caseName, caseFolder }) => {
|
|
32
|
+
test(`eslint ${caseName}`, () => {
|
|
33
|
+
const config: unknown = JSON.parse(
|
|
34
|
+
fs.readFileSync(`${path.join(caseFolder, caseName)}`, 'utf-8')
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
if (!T.satisfy(eslint, config)) fail('should satisfy')
|
|
38
|
+
})
|
|
39
|
+
})
|
package/ts/types/satisfy.spec.ts
CHANGED
package/ts/utils/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './as'
|
|
2
|
-
export
|
|
1
|
+
export * from './as'
|
|
2
|
+
export type { Widen } from './Widen'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isEmptyObject.js","sourceRoot":"","sources":["../../ts/predicates/isEmptyObject.ts"],"names":[],"mappings":""}
|
package/cjs/types/AllType.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Any } from './Any';
|
|
2
|
-
import { Array } from './Array';
|
|
3
|
-
import { Boolean } from './Boolean';
|
|
4
|
-
import { Null } from './Null';
|
|
5
|
-
import { Number } from './Number';
|
|
6
|
-
import { ObjectType } from './Object';
|
|
7
|
-
import { Record } from './Record';
|
|
8
|
-
import { String } from './String';
|
|
9
|
-
import { Symbol } from './Symbol';
|
|
10
|
-
import { Tuple } from './Tuple';
|
|
11
|
-
import { Undefined } from './Undefined';
|
|
12
|
-
import { Union } from './Union';
|
|
13
|
-
import { Unknown } from './Unknown';
|
|
14
|
-
export declare type AllType = Undefined | Null | Boolean | Number | String | ObjectType | Record | Array | Tuple | Union | Unknown | Any | Symbol;
|
|
15
|
-
export declare namespace AllType {
|
|
16
|
-
type PrimitiveValues = boolean | number | string;
|
|
17
|
-
type Analysis = Any.Analysis | Unknown.Analysis | Undefined.Analysis | Null.Analysis | Boolean.Analysis | Number.Analysis | String.Analysis | Symbol.Analysis | ObjectType.Analysis | Record.Analysis | Array.Analysis | Tuple.Analysis | Union.Analysis;
|
|
18
|
-
}
|
package/cjs/types/AllType.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AllType.js","sourceRoot":"","sources":["../../ts/types/AllType.ts"],"names":[],"mappings":""}
|
package/cjs/types/Any.d.ts
DELETED
package/cjs/types/Any.js
DELETED
package/cjs/types/Any.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Any.js","sourceRoot":"","sources":["../../ts/types/Any.ts"],"names":[],"mappings":";;;AAMa,QAAA,GAAG,GAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA"}
|
package/cjs/types/Array.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { AllType } from './AllType';
|
|
2
|
-
import { Type } from './types';
|
|
3
|
-
import { Undefined } from './Undefined';
|
|
4
|
-
import { Union } from './Union';
|
|
5
|
-
export declare type Array<Value extends AllType = any> = Type<'array', Value>;
|
|
6
|
-
export declare namespace Array {
|
|
7
|
-
type Analysis<Value extends AllType.PrimitiveValues | AllType.Analysis = any> = {
|
|
8
|
-
type: 'array';
|
|
9
|
-
value?: Value;
|
|
10
|
-
fail?: true;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Creates an array type.
|
|
15
|
-
*/
|
|
16
|
-
declare function create<Value extends AllType>(value: Value): Array<Value>;
|
|
17
|
-
export declare const array: Array<any> & {
|
|
18
|
-
any: Array<any>;
|
|
19
|
-
create: typeof create;
|
|
20
|
-
optional: Union<[Array<any>, Undefined]> & {
|
|
21
|
-
/**
|
|
22
|
-
* Creates an optional array type.
|
|
23
|
-
*/
|
|
24
|
-
create<Value extends AllType>(value: Value): Union<[Array<Value>, Undefined]>;
|
|
25
|
-
};
|
|
26
|
-
unknown: Array<import("./Unknown").Unknown>;
|
|
27
|
-
};
|
|
28
|
-
export {};
|
package/cjs/types/Array.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.array = void 0;
|
|
4
|
-
var Undefined_1 = require("./Undefined");
|
|
5
|
-
var Union_1 = require("./Union");
|
|
6
|
-
var Unknown_1 = require("./Unknown");
|
|
7
|
-
/**
|
|
8
|
-
* Creates an array type.
|
|
9
|
-
*/
|
|
10
|
-
function create(value) {
|
|
11
|
-
return {
|
|
12
|
-
type: 'array',
|
|
13
|
-
value: value
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
var any = create(undefined);
|
|
17
|
-
exports.array = Object.assign({}, any, {
|
|
18
|
-
any: any,
|
|
19
|
-
create: create,
|
|
20
|
-
optional: Object.assign(Union_1.union.create(any, Undefined_1.undef), {
|
|
21
|
-
/**
|
|
22
|
-
* Creates an optional array type.
|
|
23
|
-
*/
|
|
24
|
-
create: function (value) {
|
|
25
|
-
return Union_1.union.create(create(value), Undefined_1.undef);
|
|
26
|
-
}
|
|
27
|
-
}),
|
|
28
|
-
unknown: create(Unknown_1.unknown)
|
|
29
|
-
});
|
|
30
|
-
//# sourceMappingURL=Array.js.map
|
package/cjs/types/Array.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Array.js","sourceRoot":"","sources":["../../ts/types/Array.ts"],"names":[],"mappings":";;;AAGA,yCAA8C;AAC9C,iCAAsC;AACtC,qCAAmC;AAanC;;GAEG;AACH,SAAS,MAAM,CAAwB,KAAY;IACjD,OAAO;QACL,IAAI,EAAE,OAAO;QACb,KAAK,OAAA;KACN,CAAA;AACH,CAAC;AAED,IAAM,GAAG,GAAG,MAAM,CAAC,SAA2B,CAAC,CAAA;AAElC,QAAA,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE;IAC1C,GAAG,KAAA;IACH,MAAM,QAAA;IACN,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,aAAK,CAAC,MAAM,CAAC,GAAG,EAAE,iBAAK,CAAC,EAAE;QAChD;;WAEG;QACH,MAAM,EAAN,UAA8B,KAAY;YACxC,OAAO,aAAK,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,iBAAK,CAAC,CAAA;QAC3C,CAAC;KACF,CAAC;IACF,OAAO,EAAE,MAAM,CAAC,iBAAO,CAAC;CACzB,CAAC,CAAA"}
|
package/cjs/types/Boolean.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Type } from './types';
|
|
2
|
-
import { Undefined } from './Undefined';
|
|
3
|
-
import { Union } from './Union';
|
|
4
|
-
export declare type Boolean<Value extends boolean = boolean> = Type<'boolean', Value>;
|
|
5
|
-
export declare namespace Boolean {
|
|
6
|
-
type Analysis = {
|
|
7
|
-
type: 'boolean';
|
|
8
|
-
value?: boolean;
|
|
9
|
-
fail?: true;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export declare type True = Boolean<true>;
|
|
13
|
-
export declare type False = Boolean<false>;
|
|
14
|
-
declare function create<Value extends boolean>(value: Value): Boolean<Value>;
|
|
15
|
-
export declare const boolean: Boolean<boolean> & {
|
|
16
|
-
any: Boolean<boolean>;
|
|
17
|
-
true: Boolean<true>;
|
|
18
|
-
false: Boolean<false>;
|
|
19
|
-
create: typeof create;
|
|
20
|
-
optional: Union<[Boolean<boolean>, Undefined]> & {
|
|
21
|
-
/**
|
|
22
|
-
* Creates an optional boolean type.
|
|
23
|
-
*/
|
|
24
|
-
create<Value extends boolean>(value: Value): Union<[Boolean<Value>, Undefined]>;
|
|
25
|
-
true: Union<[Boolean<true>, Undefined]>;
|
|
26
|
-
false: Union<[Boolean<false>, Undefined]>;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
export {};
|
package/cjs/types/Boolean.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.boolean = void 0;
|
|
4
|
-
var Undefined_1 = require("./Undefined");
|
|
5
|
-
var Union_1 = require("./Union");
|
|
6
|
-
function create(value) {
|
|
7
|
-
return { type: 'boolean', value: value };
|
|
8
|
-
}
|
|
9
|
-
var any = create(undefined);
|
|
10
|
-
var t = create(true);
|
|
11
|
-
var f = create(false);
|
|
12
|
-
exports.boolean = Object.assign(any, {
|
|
13
|
-
any: any,
|
|
14
|
-
true: t,
|
|
15
|
-
false: f,
|
|
16
|
-
create: create,
|
|
17
|
-
optional: Object.assign(Union_1.union.create(any, Undefined_1.undef), {
|
|
18
|
-
/**
|
|
19
|
-
* Creates an optional boolean type.
|
|
20
|
-
*/
|
|
21
|
-
create: function (value) {
|
|
22
|
-
return Union_1.union.create(create(value), Undefined_1.undef);
|
|
23
|
-
},
|
|
24
|
-
true: Union_1.union.create(t, Undefined_1.undef),
|
|
25
|
-
false: Union_1.union.create(f, Undefined_1.undef),
|
|
26
|
-
})
|
|
27
|
-
});
|
|
28
|
-
//# sourceMappingURL=Boolean.js.map
|
package/cjs/types/Boolean.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Boolean.js","sourceRoot":"","sources":["../../ts/types/Boolean.ts"],"names":[],"mappings":";;;AACA,yCAA8C;AAC9C,iCAAsC;AAUtC,SAAS,MAAM,CAAwB,KAAY;IACjD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,OAAA,EAAE,CAAA;AACnC,CAAC;AAED,IAAM,GAAG,GAAG,MAAM,CAAC,SAA+B,CAAC,CAAA;AACnD,IAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;AACtB,IAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;AAEV,QAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;IACxC,GAAG,KAAA;IACH,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,MAAM,QAAA;IACN,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,aAAK,CAAC,MAAM,CAAC,GAAG,EAAE,iBAAK,CAAC,EAAE;QAChD;;WAEG;QACH,MAAM,EAAN,UAA8B,KAAY;YACxC,OAAO,aAAK,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,iBAAK,CAAC,CAAA;QAC3C,CAAC;QACD,IAAI,EAAE,aAAK,CAAC,MAAM,CAAC,CAAC,EAAE,iBAAK,CAAC;QAC5B,KAAK,EAAE,aAAK,CAAC,MAAM,CAAC,CAAC,EAAE,iBAAK,CAAC;KAC9B,CAAC;CACH,CAAC,CAAA"}
|
package/cjs/types/Generate.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Tail } from '../array';
|
|
2
|
-
import { AllType } from './AllType';
|
|
3
|
-
import { Any } from './Any';
|
|
4
|
-
import { Array } from './Array';
|
|
5
|
-
import { Boolean, False, True } from './Boolean';
|
|
6
|
-
import { Null } from './Null';
|
|
7
|
-
import { Number } from './Number';
|
|
8
|
-
import { ObjectType } from './Object';
|
|
9
|
-
import { Record } from './Record';
|
|
10
|
-
import { String } from './String';
|
|
11
|
-
import { Symbol } from './Symbol';
|
|
12
|
-
import { Tuple } from './Tuple';
|
|
13
|
-
import { Undefined } from './Undefined';
|
|
14
|
-
import { Union } from './Union';
|
|
15
|
-
import { Unknown } from './Unknown';
|
|
16
|
-
export declare type Generate<T extends AllType> = T extends Undefined ? undefined : T extends Null ? null : T extends True ? true : T extends False ? false : T extends Boolean ? boolean : T extends Symbol ? symbol : T extends Any ? any : T extends Unknown ? unknown : T extends Number ? T['value'] : T extends String ? T['value'] : T extends ObjectType ? {
|
|
17
|
-
[K in keyof T['value']]: Generate<T['value'][K]>;
|
|
18
|
-
} : T extends Record ? {
|
|
19
|
-
[K: string]: Generate<T['value']>;
|
|
20
|
-
} : T extends Array ? Generate<T['value']>[] : T extends Tuple ? Generate._TupleDevice<T['value']>['result'] : T extends Union ? Generate._UnionDevice<T['value']>['result'] : unknown;
|
|
21
|
-
export declare namespace Generate {
|
|
22
|
-
type _UnionDevice<T extends AllType[]> = T['length'] extends 0 ? {
|
|
23
|
-
result: never;
|
|
24
|
-
} : {
|
|
25
|
-
result: Generate<T[0]> | _UnionDevice<Tail<T>>['result'];
|
|
26
|
-
};
|
|
27
|
-
type _TupleDevice<T extends AllType[]> = T['length'] extends 0 ? {
|
|
28
|
-
result: [];
|
|
29
|
-
} : {
|
|
30
|
-
result: [Generate<T[0]>, ..._TupleDevice<Tail<T>>['result']];
|
|
31
|
-
};
|
|
32
|
-
}
|
package/cjs/types/Generate.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Generate.js","sourceRoot":"","sources":["../../ts/types/Generate.ts"],"names":[],"mappings":""}
|
package/cjs/types/Null.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { TypeAnalysis, Type } from './types';
|
|
2
|
-
export declare type Null = Type<'null', undefined>;
|
|
3
|
-
export declare namespace Null {
|
|
4
|
-
type Analysis = TypeAnalysis<'null'>;
|
|
5
|
-
}
|
|
6
|
-
export declare const nil: Null & {
|
|
7
|
-
optional: import("./Union").Union<[Null, import("./Undefined").Undefined]>;
|
|
8
|
-
};
|
package/cjs/types/Null.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.nil = void 0;
|
|
4
|
-
var Undefined_1 = require("./Undefined");
|
|
5
|
-
var Union_1 = require("./Union");
|
|
6
|
-
var any = { type: 'null', value: undefined };
|
|
7
|
-
exports.nil = Object.assign({}, any, {
|
|
8
|
-
optional: Union_1.union.create(any, Undefined_1.undef)
|
|
9
|
-
});
|
|
10
|
-
//# sourceMappingURL=Null.js.map
|
package/cjs/types/Null.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Null.js","sourceRoot":"","sources":["../../ts/types/Null.ts"],"names":[],"mappings":";;;AACA,yCAAmC;AACnC,iCAA+B;AAO/B,IAAM,GAAG,GAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;AAEvC,QAAA,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE;IACxC,QAAQ,EAAE,aAAK,CAAC,MAAM,CAAC,GAAG,EAAE,iBAAK,CAAC;CACnC,CAAC,CAAA"}
|
package/cjs/types/Number.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Tail } from '../array';
|
|
2
|
-
import { Type } from './types';
|
|
3
|
-
import { Undefined } from './Undefined';
|
|
4
|
-
import { Union } from './Union';
|
|
5
|
-
export declare type Number<Value extends number = number> = Type<'number', Value>;
|
|
6
|
-
export declare namespace Number {
|
|
7
|
-
type Analysis = {
|
|
8
|
-
type: 'number';
|
|
9
|
-
value?: number;
|
|
10
|
-
fail?: true;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
declare type NumberListDevice<Values extends number[] = number[]> = Values['length'] extends 0 ? {
|
|
14
|
-
result: [];
|
|
15
|
-
} : Values['length'] extends 1 ? {
|
|
16
|
-
result: [Number<Values[0]>];
|
|
17
|
-
} : {
|
|
18
|
-
result: [Number<Values[0]>, Number<Values[1]>, ...NumberListDevice<Tail<Tail<Values>>>['result']];
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Creates a single number type.
|
|
22
|
-
*/
|
|
23
|
-
declare function create<Value extends number>(value: Value): Number<Value>;
|
|
24
|
-
export declare const number: Number<number> & {
|
|
25
|
-
any: Number<number>;
|
|
26
|
-
create: typeof create;
|
|
27
|
-
list<Value extends number, Values extends number[]>(value: Value, ...values: Values): Union<NumberListDevice<[Value, ...Values]>["result"]>;
|
|
28
|
-
optional: Union<[Number<number>, Undefined]> & {
|
|
29
|
-
/**
|
|
30
|
-
* Creates an optional number constant type.
|
|
31
|
-
*/
|
|
32
|
-
create<Value_1 extends number>(value: Value_1): Union<[Number<Value_1>, Undefined]>;
|
|
33
|
-
list<Value_2 extends number, Values_1 extends number[]>(value: Value_2, ...values: Values_1): Union<[...NumberListDevice<[Value_2, ...Values_1]>["result"], Undefined]>;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
export {};
|
package/cjs/types/Number.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
-
if (ar || !(i in from)) {
|
|
5
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
-
ar[i] = from[i];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.number = void 0;
|
|
13
|
-
var Undefined_1 = require("./Undefined");
|
|
14
|
-
var Union_1 = require("./Union");
|
|
15
|
-
/**
|
|
16
|
-
* Creates a single number type.
|
|
17
|
-
*/
|
|
18
|
-
function create(value) {
|
|
19
|
-
return { type: 'number', value: value };
|
|
20
|
-
}
|
|
21
|
-
var any = create(undefined);
|
|
22
|
-
exports.number = Object.assign(any, {
|
|
23
|
-
any: any,
|
|
24
|
-
create: create,
|
|
25
|
-
// @ts-ignore we know that this can be infinite
|
|
26
|
-
list: function (value) {
|
|
27
|
-
var values = [];
|
|
28
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
29
|
-
values[_i - 1] = arguments[_i];
|
|
30
|
-
}
|
|
31
|
-
return Union_1.union.create.apply(Union_1.union, __spreadArray([create(value)], values.map(create), false));
|
|
32
|
-
},
|
|
33
|
-
optional: Object.assign(Union_1.union.create(any, Undefined_1.undef), {
|
|
34
|
-
/**
|
|
35
|
-
* Creates an optional number constant type.
|
|
36
|
-
*/
|
|
37
|
-
create: function (value) {
|
|
38
|
-
return Union_1.union.create(create(value), Undefined_1.undef);
|
|
39
|
-
},
|
|
40
|
-
// @ts-ignore we know that this can be infinite
|
|
41
|
-
list: function (value) {
|
|
42
|
-
var values = [];
|
|
43
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
44
|
-
values[_i - 1] = arguments[_i];
|
|
45
|
-
}
|
|
46
|
-
return Union_1.union.create.apply(Union_1.union, __spreadArray(__spreadArray([create(value)], values.map(create), false), [Undefined_1.undef], false));
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
});
|
|
50
|
-
//# sourceMappingURL=Number.js.map
|
package/cjs/types/Number.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Number.js","sourceRoot":"","sources":["../../ts/types/Number.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,yCAA8C;AAC9C,iCAAsC;AAiBtC;;GAEG;AACH,SAAS,MAAM,CAAuB,KAAY;IAChD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,OAAA,EAAE,CAAA;AAClC,CAAC;AAED,IAAM,GAAG,GAAG,MAAM,CAAC,SAA8B,CAAC,CAAA;AAErC,QAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;IACvC,GAAG,KAAA;IACH,MAAM,QAAA;IACN,+CAA+C;IAC/C,IAAI,EAAJ,UAAoD,KAAY;QAAE,gBAAiB;aAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;YAAjB,+BAAiB;;QAKjF,OAAO,aAAK,CAAC,MAAM,OAAZ,aAAK,iBAAQ,MAAM,CAAC,KAAK,CAAC,GAAK,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,SAAQ,CAAA;IAClE,CAAC;IACD,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,aAAK,CAAC,MAAM,CAAC,GAAG,EAAE,iBAAK,CAAC,EAAE;QAChD;;WAEG;QACH,MAAM,EAAN,UAA6B,KAAY;YACvC,OAAO,aAAK,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,iBAAK,CAAC,CAAA;QAC3C,CAAC;QACD,+CAA+C;QAC/C,IAAI,EAAJ,UAAoD,KAAY;YAAE,gBAAiB;iBAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;gBAAjB,+BAAiB;;YAIjF,OAAO,aAAK,CAAC,MAAM,OAAZ,aAAK,+BAAQ,MAAM,CAAC,KAAK,CAAC,GAAK,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,WAAE,iBAAK,UAAQ,CAAA;QACzE,CAAC;KACF,CAAC;CACH,CAAC,CAAA"}
|