@@ -8,173 +8,11 @@ TypeScript common types.
88[ ![ NPM Downloads] [ npm-downloads-img ]] [ npm-downloads-url ]
99[ ![ TypeScript Typings] [ ts-img ]] [ ts-url ]
1010
11- # Reference
11+ ---
1212
13- ## Class
13+ Documentation [ https://corefunc.github.io/type ] ( https://corefunc.github.io/type ) .
1414
15- ### Complete
16-
17- ``` typescript
18- import type { CompleteType } from " @corefunc/type/class/complete.type" ;
19- interface UserInterface {
20- name: string ;
21- zip: string ;
22- }
23- // Forces class to implement all interface properties.
24- class User implements CompleteType <UserInterface > {
25- public name: string ;
26- public zip: string ;
27- }
28- ```
29-
30- ### Concrete
31-
32- ``` typescript
33- import type { ConcreteType } from " @corefunc/type/class/concrete.type" ;
34- interface UserInterface {
35- email: string ;
36- nickname? : string ;
37- }
38- // Disallow 'optional' properties from inherited type.
39- class User implements ConcreteType <UserInterface > {
40- email: string ;
41- nickname: string | undefined ;
42- }
43- ```
44-
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-
71- ## Number
72-
73- ### Float
74-
75- ``` typescript
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 ;
79- ```
80-
81- ### Integer 16
82-
83- ``` typescript
84- import { isInteger16 , assertInteger16 , INT16 , INT16_MAX , INT16_MIN } from " @corefunc/type" ;
85- import type { TypeInteger16 , Integer16Type , Integer16 } from " @corefunc/type" ;
86- const value: TypeInteger16 = 32_767 ;
87- ```
88-
89- ### Integer 32
90-
91- ``` typescript
92- import { isInteger32 , assertInteger32 , INT32 , INT32_MAX , INT32_MIN } from " @corefunc/type" ;
93- import type { TypeInteger32 , Integer32Type , Integer32 } from " @corefunc/type" ;
94- const value: TypeInteger32 = 2_147_483_647 ;
95- ```
96-
97- ### Integer 64
98-
99- ``` typescript
100- import { isInteger64 , assertInteger64 , INT64 , INT64_MAX , INT64_MIN } from " @corefunc/type" ;
101- import type { TypeInteger64 , Integer64Type , Integer64 } from " @corefunc/type" ;
102- const value: TypeInteger64 = 9_223_372_036_854_775_807 ;
103- ```
104-
105- ### Integer Range
106-
107- ``` typescript
108- import { isIntegerRange , assertIntegerRange } from " @corefunc/type" ;
109- import type { TypeIntegerRange , IntegerRangeType , IntegerRange } from " @corefunc/type" ;
110- const value: TypeIntegerRange <0 , 100 > = 50 ;
111- ```
112-
113- ### Numeric
114-
115- ``` typescript
116- import { isNumeric , assertNumeric } from " @corefunc/type" ;
117- import type { TypeNumeric , NumericType , Numeric } from " @corefunc/type" ;
118- const value: TypeNumeric <5 , 2 > = 999.99 ;
119- ```
120-
121- ## String
122-
123- ### String Date
124-
125- ``` typescript
126- import { isStringDate , assertStringDate } from " @corefunc/type" ;
127- import type { TypeStringDate , StringDateType , StringDate } from " @corefunc/type" ;
128- const value: StringDate = " 2020-01-01" ;
129- ```
130-
131- ### String Fixed
132-
133- ``` typescript
134- import { isStringFixed , assertStringFixed } from " @corefunc/type" ;
135- import type { TypeStringFixed , StringFixedType , StringFixed } from " @corefunc/type" ;
136- const value: StringFixed <3 > = " USD" ;
137- ```
138-
139- ### String Of Length
140-
141- ``` typescript
142- import { isStringOfLength , assertStringOfLength } from " @corefunc/type" ;
143- import type { TypeStringOfLength , StringOfLengthType , StringOfLength } from " @corefunc/type" ;
144- const value: StringOfLength <2 , 99 > = " Billy" ;
145- ```
146-
147- ### String Time
148-
149- ``` typescript
150- import { isStringTime , assertStringTime } from " @corefunc/type" ;
151- import type { TypeStringTime , StringTimeType , StringTime } from " @corefunc/type" ;
152- const value: StringTime = " 12:59" ;
153- ```
154-
155- ### String Varying
156-
157- ``` typescript
158- import { isStringVarying , assertStringVarying } from " @corefunc/type" ;
159- import type { TypeStringVarying , StringVaryingType , StringVarying } from " @corefunc/type" ;
160- const value: StringVarying <254 > = " user+inbox@domain" ;
161- ```
162-
163- ### UUID
164-
165- ``` typescript
166- import { isUuid , assertUuid } from " @corefunc/type" ;
167- import type { TypeUUID , UUIDType , UUID } from " @corefunc/type" ;
168- const value: UUID = " 0b0bc0f0-db42-11eb-8d19-0242ac130003" ;
169- ```
170-
171- ### UUID 4
172-
173- ``` typescript
174- import { isUuid4 , assertUuid4 } from " @corefunc/type" ;
175- import type { TypeUUID4 , UUID4Type , UUID4 } from " @corefunc/type" ;
176- const value: UUID4 = " 155fbaaf-09de-4141-80df-94696eed4cb6" ;
177- ```
15+ ---
17816
17917## See also
18018
@@ -184,9 +22,9 @@ const value: UUID4 = "155fbaaf-09de-4141-80df-94696eed4cb6";
18422
18523<!-- Badges -->
18624
187- [ npm-version-url ] : https://npmjs.com/package/@corefunc/type
188- [ npm-version-img ] : https://badgen.net/npm/v/@corefunc/type ?&icon=npm&label=npm&color=DD3636
189- [ npm-downloads-url ] : https://npmjs.com/package/@corefunc/type
190- [ npm-downloads-img ] : https://badgen.net/npm/dt/@corefunc/type ?&icon=terminal&label=downloads&color=009688
191- [ ts-url ] : https://github.com/corefunc/type /blob/master /index.d.ts
192- [ ts-img ] : https://badgen.net/npm/types/@corefunc/type ?&icon=typescript&label=types&color=1E90FF
25+ [ npm-version-url ] : https://npmjs.com/package/@nestjsi/class-validator
26+ [ npm-version-img ] : https://badgen.net/npm/v/@nestjsi/class-validator ?&icon=npm&label=npm&color=DD3636
27+ [ npm-downloads-url ] : https://npmjs.com/package/@nestjsi/class-validator
28+ [ npm-downloads-img ] : https://badgen.net/npm/dt/@nestjsi/class-validator ?&icon=terminal&label=downloads&color=009688
29+ [ ts-url ] : https://github.com/nestjsi/class-validator /blob/main/dist /index.d.ts
30+ [ ts-img ] : https://badgen.net/npm/types/@nestjsi/class-validator ?&icon=typescript&label=types&color=1E90FF
0 commit comments