type-safe-builder-pattern 0.0.5 → 0.1.5
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/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -1
- package/package.json +7 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { BuilderAddProperty } from "./types";
|
|
2
2
|
type SchemaConstraint = Record<string, unknown>;
|
|
3
|
-
type ObjectBuilderSetFunctionReturnType<
|
|
4
|
-
interface ObjectBuilderHelperType<
|
|
5
|
-
set: <const Key extends keyof Schema & string, const Value extends Schema[Key], const
|
|
3
|
+
type ObjectBuilderSetFunctionReturnType<Current extends SchemaConstraint, Schema extends SchemaConstraint> = Current extends Schema ? ObjectBuilderHelperWithBuildMethodType<Current, Schema> : ObjectBuilderHelperType<Current, Schema>;
|
|
4
|
+
interface ObjectBuilderHelperType<Current extends SchemaConstraint, Schema extends SchemaConstraint> {
|
|
5
|
+
set: <const Key extends Exclude<keyof Schema, keyof Current> & string, const Value extends Schema[Key], const Next extends object & BuilderAddProperty<Key, Value, Current> = BuilderAddProperty<Key, Value, Current>>(key: Key, value: Value) => ObjectBuilderSetFunctionReturnType<Next, Schema>;
|
|
6
6
|
}
|
|
7
|
-
interface ObjectBuilderHelperWithBuildMethodType<
|
|
8
|
-
build: () =>
|
|
7
|
+
interface ObjectBuilderHelperWithBuildMethodType<Current extends SchemaConstraint, Schema extends SchemaConstraint> extends ObjectBuilderHelperType<Current, Schema> {
|
|
8
|
+
build: () => Current;
|
|
9
9
|
}
|
|
10
10
|
export declare function objectBuilder<const Schema extends SchemaConstraint>(): ObjectBuilderSetFunctionReturnType<{}, Schema>;
|
|
11
11
|
export {};
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sour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,OAAO,CAAC;CACxB;AAED,wBAAgB,aAAa,CAAC,KAAK,CAAC,MAAM,SAAS,gBAAgB,oDAElE"}
|
package/dist/index.js
CHANGED
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,KAAK,0BAA0B,CAC3B,UAAU,SAAS,MAAM,EACzB,KAAK,EACL,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,IAClD;KACC,CAAC,IAAI,MAAM,aAAa,GAAG,aAAa,CAAC,CAAC,CAAC;CAC/C,GAAG,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAE9B,KAAK,oBAAoB,CACrB,UAAU,SAAS,MAAM,EACzB,KAAK,EACL,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,IAClD,0BAA0B,CAC1B,UAAU,EACV,KAAK,EACL,UAAU,SAAS,MAAM,aAAa,GAChC,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,GAC/B,aAAa,CACtB,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAC1B,GAAG,SAAS,MAAM,EAClB,KAAK,EACL,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,IAClD,MAAM,SAAS,GAAG,GAChB,KAAK,GACL,qBAAqB,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC;AAE7E,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;KAClE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACvB,GAAG,EAAE,CAAC"}
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "type-safe-builder-pattern",
|
|
3
3
|
"description": "Implementation of the 'Builder' design pattern in typescript",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.1.5",
|
|
5
5
|
"author": "Romeo Sarkar",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -30,7 +30,12 @@
|
|
|
30
30
|
"builder",
|
|
31
31
|
"builder-pattern",
|
|
32
32
|
"type-safe-builder-pattern",
|
|
33
|
-
"type-safe"
|
|
33
|
+
"type-safe",
|
|
34
|
+
"design-patterns",
|
|
35
|
+
"builder-design-pattern",
|
|
36
|
+
"typescript-design-patterns",
|
|
37
|
+
"typescript-wizard",
|
|
38
|
+
"wizard"
|
|
34
39
|
],
|
|
35
40
|
"scripts": {
|
|
36
41
|
"build": "tsc -p tsconfig.src.json",
|