@@ -15,9 +15,7 @@ TypeScript common types.
1515### Complete
1616
1717``` typescript
18- import type {
19- CompleteType
20- } from ' @corefunc/type/class/complete.type' ;
18+ import type { CompleteType } from " @corefunc/type/class/complete.type" ;
2119interface UserInterface {
2220 name: string ;
2321 zip: string ;
@@ -29,10 +27,10 @@ class User implements CompleteType<UserInterface> {
2927}
3028```
3129
30+ ### Concrete
31+
3232``` typescript
33- import type {
34- ConcreteType
35- } from ' @corefunc/type/class/concrete.type' ;
33+ import type { ConcreteType } from " @corefunc/type/class/concrete.type" ;
3634interface UserInterface {
3735 email: string ;
3836 nickname? : string ;
@@ -44,75 +42,79 @@ class User implements ConcreteType<UserInterface> {
4442}
4543```
4644
45+ ### Constructor
46+
47+ ``` typescript
48+ import type { ConstructorType } from " @corefunc/type/class/constructor.type" ;
49+
50+ class ExchangeClient {}
51+
52+ function mixinApiPostUser<T extends ConstructorType <ExchangeClient >>(superClass : T ) {
53+ return class extends superClass {
54+ public postUser(data : any ) {
55+ return this .post (` /users/ ` , data );
56+ }
57+ };
58+ }
59+
60+ function mixinApiGetUser<T extends ConstructorType <ExchangeClient >>(superClass : T ) {
61+ return class extends superClass {
62+ public getUser(id : string ) {
63+ return this .get (` /users/${id } ` );
64+ }
65+ };
66+ }
67+
68+ class ApiClient extends mixinApiPostUser (mixinApiGetUser (ExchangeClient )) {}
69+ ```
70+
4771## Number
4872
4973### Float
5074
5175``` typescript
52- import {
53- isFloatRange , assertFloatRange
54- } from ' @corefunc/type' ;
55- import {
56- TypeFloatRange , FloatRangeType , FloatRange
57- } from ' @corefunc/type' ;
58- const value: TypeFloatRange <0.01 , 99.99 > = 10.50 ;
76+ import { isFloatRange , assertFloatRange } from " @corefunc/type" ;
77+ import { TypeFloatRange , FloatRangeType , FloatRange } from " @corefunc/type" ;
78+ const value: TypeFloatRange <0.01 , 99.99 > = 10.5 ;
5979```
6080
6181### Integer 16
6282
6383``` typescript
64- import {
65- isInteger16 , assertInteger16 , INT16 , INT16_MAX , INT16_MIN
66- } from ' @corefunc/type' ;
67- import type {
68- TypeInteger16 , Integer16Type , Integer16
69- } from ' @corefunc/type' ;
84+ import { isInteger16 , assertInteger16 , INT16 , INT16_MAX , INT16_MIN } from " @corefunc/type" ;
85+ import type { TypeInteger16 , Integer16Type , Integer16 } from " @corefunc/type" ;
7086const value: TypeInteger16 = 32_767 ;
7187```
7288
7389### Integer 32
7490
7591``` typescript
76- import {
77- isInteger32 , assertInteger32 , INT32 , INT32_MAX , INT32_MIN
78- } from ' @corefunc/type' ;
79- import type {
80- TypeInteger32 , Integer32Type , Integer32
81- } from ' @corefunc/type' ;
92+ import { isInteger32 , assertInteger32 , INT32 , INT32_MAX , INT32_MIN } from " @corefunc/type" ;
93+ import type { TypeInteger32 , Integer32Type , Integer32 } from " @corefunc/type" ;
8294const value: TypeInteger32 = 2_147_483_647 ;
8395```
8496
8597### Integer 64
8698
8799``` typescript
88- import {
89- isInteger64 , assertInteger64 , INT64 , INT64_MAX , INT64_MIN
90- } from ' @corefunc/type' ;
91- import type {
92- TypeInteger64 , Integer64Type , Integer64
93- } from ' @corefunc/type' ;
100+ import { isInteger64 , assertInteger64 , INT64 , INT64_MAX , INT64_MIN } from " @corefunc/type" ;
101+ import type { TypeInteger64 , Integer64Type , Integer64 } from " @corefunc/type" ;
94102const value: TypeInteger64 = 9_223_372_036_854_775_807 ;
95103```
96104
97105### Integer Range
98106
99107``` typescript
100- import {
101- isIntegerRange , assertIntegerRange
102- } from ' @corefunc/type' ;
103- import type {
104- TypeIntegerRange , IntegerRangeType , IntegerRange
105- } from ' @corefunc/type' ;
108+ import { isIntegerRange , assertIntegerRange } from " @corefunc/type" ;
109+ import type { TypeIntegerRange , IntegerRangeType , IntegerRange } from " @corefunc/type" ;
106110const value: TypeIntegerRange <0 , 100 > = 50 ;
107111```
108112
109113### Numeric
110114
111115``` typescript
112- import { isNumeric , assertNumeric } from ' @corefunc/type' ;
113- import type {
114- TypeNumeric , NumericType , Numeric
115- } from ' @corefunc/type' ;
116+ import { isNumeric , assertNumeric } from " @corefunc/type" ;
117+ import type { TypeNumeric , NumericType , Numeric } from " @corefunc/type" ;
116118const value: TypeNumeric <5 , 2 > = 999.99 ;
117119```
118120
@@ -121,80 +123,56 @@ const value: TypeNumeric<5, 2> = 999.99;
121123### String Date
122124
123125``` typescript
124- import {
125- isStringDate , assertStringDate
126- } from ' @corefunc/type' ;
127- import type {
128- TypeStringDate , StringDateType , StringDate
129- } from ' @corefunc/type' ;
126+ import { isStringDate , assertStringDate } from " @corefunc/type" ;
127+ import type { TypeStringDate , StringDateType , StringDate } from " @corefunc/type" ;
130128const value: StringDate = " 2020-01-01" ;
131129```
132130
133131### String Fixed
134132
135133``` typescript
136- import {
137- isStringFixed , assertStringFixed
138- } from ' @corefunc/type' ;
139- import type {
140- TypeStringFixed , StringFixedType , StringFixed
141- } from ' @corefunc/type' ;
134+ import { isStringFixed , assertStringFixed } from " @corefunc/type" ;
135+ import type { TypeStringFixed , StringFixedType , StringFixed } from " @corefunc/type" ;
142136const value: StringFixed <3 > = " USD" ;
143137```
144138
145139### String Of Length
146140
147141``` typescript
148- import {
149- isStringOfLength , assertStringOfLength
150- } from ' @corefunc/type' ;
151- import type {
152- TypeStringOfLength , StringOfLengthType , StringOfLength
153- } from ' @corefunc/type' ;
142+ import { isStringOfLength , assertStringOfLength } from " @corefunc/type" ;
143+ import type { TypeStringOfLength , StringOfLengthType , StringOfLength } from " @corefunc/type" ;
154144const value: StringOfLength <2 , 99 > = " Billy" ;
155145```
156146
157147### String Time
158148
159149``` typescript
160- import {
161- isStringTime , assertStringTime
162- } from ' @corefunc/type' ;
163- import type {
164- TypeStringTime , StringTimeType , StringTime
165- } from ' @corefunc/type' ;
150+ import { isStringTime , assertStringTime } from " @corefunc/type" ;
151+ import type { TypeStringTime , StringTimeType , StringTime } from " @corefunc/type" ;
166152const value: StringTime = " 12:59" ;
167153```
168154
169155### String Varying
170156
171157``` typescript
172- import {
173- isStringVarying , assertStringVarying
174- } from ' @corefunc/type' ;
175- import type {
176- TypeStringVarying , StringVaryingType , StringVarying
177- } from ' @corefunc/type' ;
158+ import { isStringVarying , assertStringVarying } from " @corefunc/type" ;
159+ import type { TypeStringVarying , StringVaryingType , StringVarying } from " @corefunc/type" ;
178160const value: StringVarying <254 > = " user+inbox@domain" ;
179161```
180162
181163### UUID
182164
183165``` typescript
184- import { isUuid , assertUuid } from ' @corefunc/type' ;
185- import type {
186- TypeUUID , UUIDType , UUID
187- } from ' @corefunc/type' ;
166+ import { isUuid , assertUuid } from " @corefunc/type" ;
167+ import type { TypeUUID , UUIDType , UUID } from " @corefunc/type" ;
188168const value: UUID = " 0b0bc0f0-db42-11eb-8d19-0242ac130003" ;
189169```
190170
191171### UUID 4
192172
193173``` typescript
194- import { isUuid4 , assertUuid4 } from ' @corefunc/type' ;
195- import type {
196- TypeUUID4 , UUID4Type , UUID4
197- } from ' @corefunc/type' ;
174+ import { isUuid4 , assertUuid4 } from " @corefunc/type" ;
175+ import type { TypeUUID4 , UUID4Type , UUID4 } from " @corefunc/type" ;
198176const value: UUID4 = " 155fbaaf-09de-4141-80df-94696eed4cb6" ;
199177```
200178
0 commit comments