ts-fortress 2.6.0 → 2.6.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/dist/entry-point.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/other-types/index.d.mts +2 -0
- package/dist/other-types/index.d.mts.map +1 -0
- package/dist/other-types/index.mjs +2 -0
- package/dist/other-types/index.mjs.map +1 -0
- package/dist/other-types/unknown.d.mts +3 -0
- package/dist/other-types/unknown.d.mts.map +1 -0
- package/dist/{unknown.mjs → other-types/unknown.mjs} +2 -2
- package/dist/other-types/unknown.mjs.map +1 -0
- package/dist/primitives/string.mjs +1 -1
- package/dist/primitives/string.mjs.map +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +5 -5
- package/src/compose/union.test.mts +4 -4
- package/src/index.mts +1 -1
- package/src/other-types/index.mts +1 -0
- package/src/{unknown.mts → other-types/unknown.mts} +2 -2
- package/src/primitives/string.mts +1 -1
- package/src/primitives/string.test.mts +3 -3
- package/dist/unknown.d.mts +0 -3
- package/dist/unknown.d.mts.map +0 -1
- package/dist/unknown.mjs.map +0 -1
package/dist/entry-point.mjs
CHANGED
|
@@ -29,6 +29,7 @@ export { union } from './compose/union.mjs';
|
|
|
29
29
|
export { enumType } from './enum/enum.mjs';
|
|
30
30
|
export { intRange } from './enum/int-range.mjs';
|
|
31
31
|
export { uintRange } from './enum/uint-range.mjs';
|
|
32
|
+
export { unknown } from './other-types/unknown.mjs';
|
|
32
33
|
export { int8 } from './predefined/int8.mjs';
|
|
33
34
|
export { JsonObject, JsonPrimitive, JsonValue } from './predefined/json.mjs';
|
|
34
35
|
export { uint8 } from './predefined/uint8.mjs';
|
|
@@ -46,7 +47,6 @@ export { isOptionalProperty, optional } from './record/optional.mjs';
|
|
|
46
47
|
export { partial } from './record/partial.mjs';
|
|
47
48
|
export { pick } from './record/pick.mjs';
|
|
48
49
|
export { record, strictRecord } from './record/record.mjs';
|
|
49
|
-
export { unknown } from './unknown.mjs';
|
|
50
50
|
export { createAssertFn } from './utils/create-assert-fn.mjs';
|
|
51
51
|
export { createCastFn } from './utils/create-cast-fn.mjs';
|
|
52
52
|
export { createIsFn } from './utils/create-is-fn.mjs';
|
package/dist/index.d.mts
CHANGED
|
@@ -2,10 +2,10 @@ export * from './array/index.mjs';
|
|
|
2
2
|
export * from './branded/index.mjs';
|
|
3
3
|
export * from './compose/index.mjs';
|
|
4
4
|
export * from './enum/index.mjs';
|
|
5
|
+
export * from './other-types/index.mjs';
|
|
5
6
|
export * from './predefined/index.mjs';
|
|
6
7
|
export * from './primitives/index.mjs';
|
|
7
8
|
export * from './record/index.mjs';
|
|
8
9
|
export * from './type.mjs';
|
|
9
|
-
export * from './unknown.mjs';
|
|
10
10
|
export * from './utils/index.mjs';
|
|
11
11
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -28,6 +28,7 @@ export { union } from './compose/union.mjs';
|
|
|
28
28
|
export { enumType } from './enum/enum.mjs';
|
|
29
29
|
export { intRange } from './enum/int-range.mjs';
|
|
30
30
|
export { uintRange } from './enum/uint-range.mjs';
|
|
31
|
+
export { unknown } from './other-types/unknown.mjs';
|
|
31
32
|
export { int8 } from './predefined/int8.mjs';
|
|
32
33
|
export { JsonObject, JsonPrimitive, JsonValue } from './predefined/json.mjs';
|
|
33
34
|
export { uint8 } from './predefined/uint8.mjs';
|
|
@@ -45,7 +46,6 @@ export { isOptionalProperty, optional } from './record/optional.mjs';
|
|
|
45
46
|
export { partial } from './record/partial.mjs';
|
|
46
47
|
export { pick } from './record/pick.mjs';
|
|
47
48
|
export { record, strictRecord } from './record/record.mjs';
|
|
48
|
-
export { unknown } from './unknown.mjs';
|
|
49
49
|
export { createAssertFn } from './utils/create-assert-fn.mjs';
|
|
50
50
|
export { createCastFn } from './utils/create-cast-fn.mjs';
|
|
51
51
|
export { createIsFn } from './utils/create-is-fn.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/other-types/index.mts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unknown.d.mts","sourceRoot":"","sources":["../../src/other-types/unknown.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAGxC,eAAO,MAAM,OAAO,GAAI,eAAe,OAAO,KAAG,IAAI,CAAC,OAAO,CAQ3D,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Result } from 'ts-data-forge';
|
|
2
|
-
import { createAssertFn } from '
|
|
3
|
-
import { createCastFn } from '
|
|
2
|
+
import { createAssertFn } from '../utils/create-assert-fn.mjs';
|
|
3
|
+
import { createCastFn } from '../utils/create-cast-fn.mjs';
|
|
4
4
|
|
|
5
5
|
const unknown = (defaultValue) => ({
|
|
6
6
|
typeName: 'unknown',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unknown.mjs","sources":["../../src/other-types/unknown.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;MAIa,OAAO,GAAG,CAAC,YAAsB,MAAqB;AACjE,IAAA,QAAQ,EAAE,SAAS;IACnB,YAAY;IACZ,EAAE;AACF,IAAA,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC;IACd,QAAQ;AACR,IAAA,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,IAAA,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC;AAC7B,CAAA;AAED,MAAM,QAAQ,GAA8B,MAAM,CAAC,EAAE;AAErD,MAAM,EAAE,GAAG,CAAC,EAAW,KAAoB,IAAI;;;;"}
|
|
@@ -3,7 +3,7 @@ import { createPrimitiveType } from '../utils/create-primitive-type.mjs';
|
|
|
3
3
|
|
|
4
4
|
const string = (defaultValue = '') => createPrimitiveType({ typeName: 'string', defaultValue, is: isString });
|
|
5
5
|
const stringLiteral = (literal) => createPrimitiveType({
|
|
6
|
-
typeName: `stringLiteral(${literal})`,
|
|
6
|
+
typeName: `stringLiteral("${literal}")`,
|
|
7
7
|
defaultValue: literal,
|
|
8
8
|
is: (value) => value === literal,
|
|
9
9
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.mjs","sources":["../../src/primitives/string.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIO,MAAM,MAAM,GAAG,CAAC,eAAuB,EAAE,KAC9C,mBAAmB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,EAAE,QAAQ,EAAE;AAEjE,MAAM,aAAa,GAAG,CAAmB,OAAU,KACxD,mBAAmB,CAAC;IAClB,QAAQ,EAAE,CAAA,
|
|
1
|
+
{"version":3,"file":"string.mjs","sources":["../../src/primitives/string.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIO,MAAM,MAAM,GAAG,CAAC,eAAuB,EAAE,KAC9C,mBAAmB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,EAAE,QAAQ,EAAE;AAEjE,MAAM,aAAa,GAAG,CAAmB,OAAU,KACxD,mBAAmB,CAAC;IAClB,QAAQ,EAAE,CAAA,eAAA,EAAkB,OAAO,CAAA,EAAA,CAAI;AACvC,IAAA,YAAY,EAAE,OAAO;IACrB,EAAE,EAAE,CAAC,KAAc,KAAiB,KAAK,KAAK,OAAO;AACtD,CAAA;;;;"}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './globals.d.mts';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './entry-point.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-fortress",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript"
|
|
@@ -89,16 +89,16 @@
|
|
|
89
89
|
"prettier": "^3.6.2",
|
|
90
90
|
"prettier-plugin-organize-imports": "^4.2.0",
|
|
91
91
|
"prettier-plugin-packagejson": "^2.5.19",
|
|
92
|
-
"rollup": "^4.
|
|
92
|
+
"rollup": "^4.49.0",
|
|
93
93
|
"semantic-release": "^24.2.7",
|
|
94
|
-
"ts-repo-utils": "^
|
|
94
|
+
"ts-repo-utils": "^7.0.4",
|
|
95
95
|
"tslib": "^2.8.1",
|
|
96
96
|
"tsx": "^4.20.4",
|
|
97
97
|
"typedoc": "^0.28.10",
|
|
98
98
|
"typedoc-plugin-markdown": "^4.8.1",
|
|
99
99
|
"typescript": "^5.9.2",
|
|
100
|
-
"typescript-eslint": "^8.
|
|
100
|
+
"typescript-eslint": "^8.41.0",
|
|
101
101
|
"vitest": "^3.2.4",
|
|
102
|
-
"zod": "^4.1.
|
|
102
|
+
"zod": "^4.1.5"
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -94,14 +94,14 @@ describe('union', () => {
|
|
|
94
94
|
path: [],
|
|
95
95
|
actualValue: 5,
|
|
96
96
|
expectedType:
|
|
97
|
-
'Union<{ x: number, y: number }, numberLiteral(3), stringLiteral(2)>',
|
|
97
|
+
'Union<{ x: number, y: number }, numberLiteral(3), stringLiteral("2")>',
|
|
98
98
|
typeName:
|
|
99
|
-
'Union<{ x: number, y: number }, numberLiteral(3), stringLiteral(2)>',
|
|
99
|
+
'Union<{ x: number, y: number }, numberLiteral(3), stringLiteral("2")>',
|
|
100
100
|
message:
|
|
101
|
-
'The type of value is expected to be one of the elements contained in { { x: number, y: number }, numberLiteral(3), stringLiteral(2) }',
|
|
101
|
+
'The type of value is expected to be one of the elements contained in { { x: number, y: number }, numberLiteral(3), stringLiteral("2") }',
|
|
102
102
|
});
|
|
103
103
|
expect(validationErrorsToMessages(result.value)).toStrictEqual([
|
|
104
|
-
'The type of value is expected to be one of the elements contained in { { x: number, y: number }, numberLiteral(3), stringLiteral(2) }',
|
|
104
|
+
'The type of value is expected to be one of the elements contained in { { x: number, y: number }, numberLiteral(3), stringLiteral("2") }',
|
|
105
105
|
]);
|
|
106
106
|
}
|
|
107
107
|
});
|
package/src/index.mts
CHANGED
|
@@ -2,9 +2,9 @@ export * from './array/index.mjs';
|
|
|
2
2
|
export * from './branded/index.mjs';
|
|
3
3
|
export * from './compose/index.mjs';
|
|
4
4
|
export * from './enum/index.mjs';
|
|
5
|
+
export * from './other-types/index.mjs';
|
|
5
6
|
export * from './predefined/index.mjs';
|
|
6
7
|
export * from './primitives/index.mjs';
|
|
7
8
|
export * from './record/index.mjs';
|
|
8
9
|
export * from './type.mjs';
|
|
9
|
-
export * from './unknown.mjs';
|
|
10
10
|
export * from './utils/index.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './unknown.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Result } from 'ts-data-forge';
|
|
2
|
-
import { type Type } from '
|
|
3
|
-
import { createAssertFn, createCastFn } from '
|
|
2
|
+
import { type Type } from '../type.mjs';
|
|
3
|
+
import { createAssertFn, createCastFn } from '../utils/index.mjs';
|
|
4
4
|
|
|
5
5
|
export const unknown = (defaultValue?: unknown): Type<unknown> => ({
|
|
6
6
|
typeName: 'unknown',
|
|
@@ -7,7 +7,7 @@ export const string = (defaultValue: string = ''): Type<string> =>
|
|
|
7
7
|
|
|
8
8
|
export const stringLiteral = <L extends string>(literal: L): Type<L> =>
|
|
9
9
|
createPrimitiveType({
|
|
10
|
-
typeName: `stringLiteral(${literal})`,
|
|
10
|
+
typeName: `stringLiteral("${literal}")`,
|
|
11
11
|
defaultValue: literal,
|
|
12
12
|
is: (value: unknown): value is L => value === literal,
|
|
13
13
|
});
|
|
@@ -304,8 +304,8 @@ describe('stringLiteral', () => {
|
|
|
304
304
|
{
|
|
305
305
|
path: [],
|
|
306
306
|
actualValue: 'world',
|
|
307
|
-
expectedType: 'stringLiteral(hello)',
|
|
308
|
-
typeName: 'stringLiteral(hello)',
|
|
307
|
+
expectedType: 'stringLiteral("hello")',
|
|
308
|
+
typeName: 'stringLiteral("hello")',
|
|
309
309
|
message: undefined,
|
|
310
310
|
},
|
|
311
311
|
]);
|
|
@@ -332,7 +332,7 @@ describe('stringLiteral', () => {
|
|
|
332
332
|
test('invalid value throws error', () => {
|
|
333
333
|
const value: unknown = 'world';
|
|
334
334
|
expect(() => hello.cast(value)).toThrow(
|
|
335
|
-
'Expected stringLiteral(hello), got string',
|
|
335
|
+
'Expected stringLiteral("hello"), got string',
|
|
336
336
|
);
|
|
337
337
|
});
|
|
338
338
|
});
|
package/dist/unknown.d.mts
DELETED
package/dist/unknown.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unknown.d.mts","sourceRoot":"","sources":["../src/unknown.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,eAAO,MAAM,OAAO,GAAI,eAAe,OAAO,KAAG,IAAI,CAAC,OAAO,CAQ3D,CAAC"}
|
package/dist/unknown.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unknown.mjs","sources":["../src/unknown.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;MAIa,OAAO,GAAG,CAAC,YAAsB,MAAqB;AACjE,IAAA,QAAQ,EAAE,SAAS;IACnB,YAAY;IACZ,EAAE;AACF,IAAA,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC;IACd,QAAQ;AACR,IAAA,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,IAAA,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC;AAC7B,CAAA;AAED,MAAM,QAAQ,GAA8B,MAAM,CAAC,EAAE;AAErD,MAAM,EAAE,GAAG,CAAC,EAAW,KAAoB,IAAI;;;;"}
|