/
opt
/
canhelp
/
node_modules
/
kysely
/
dist
/
esm
/
util
/
/opt/canhelp/node_modules/kysely/dist/esm/util
mkdir
upload
Name
Size
Mode
Actions
assert.d.ts
173
0644
edit
dl
rm
assert.js
353
0644
edit
dl
rm
column-type.d.ts
6973
0644
edit
dl
rm
column-type.js
56
0644
edit
dl
rm
compilable.d.ts
227
0644
edit
dl
rm
compilable.js
199
0644
edit
dl
rm
deferred.d.ts
187
0644
edit
dl
rm
deferred.js
547
0644
edit
dl
rm
explainable.d.ts
1185
0644
edit
dl
rm
explainable.js
56
0644
edit
dl
rm
infer-result.d.ts
1670
0644
edit
dl
rm
infer-result.js
57
0644
edit
dl
rm
json-object-args.d.ts
246
0644
edit
dl
rm
json-object-args.js
1442
0644
edit
dl
rm
log-once.d.ts
183
0644
edit
dl
rm
log-once.js
363
0644
edit
dl
rm
log.d.ts
1070
0644
edit
dl
rm
log.js
1695
0644
edit
dl
rm
object-utils.d.ts
1494
0644
edit
dl
rm
object-utils.js
3642
0644
edit
dl
rm
performance-now.d.ts
50
0644
edit
dl
rm
performance-now.js
295
0644
edit
dl
rm
provide-controlled-connection.d.ts
397
0644
edit
dl
rm
provide-controlled-connection.js
1028
0644
edit
dl
rm
query-id.d.ts
109
0644
edit
dl
rm
query-id.js
349
0644
edit
dl
rm
random-string.d.ts
62
0644
edit
dl
rm
random-string.js
857
0644
edit
dl
rm
require-all-props.d.ts
1755
0644
edit
dl
rm
require-all-props.js
1592
0644
edit
dl
rm
stack-trace-utils.d.ts
84
0644
edit
dl
rm
stack-trace-utils.js
516
0644
edit
dl
rm
streamable.d.ts
880
0644
edit
dl
rm
streamable.js
55
0644
edit
dl
rm
type-error.d.ts
92
0644
edit
dl
rm
type-error.js
55
0644
edit
dl
rm
type-utils.d.ts
6095
0644
edit
dl
rm
type-utils.js
55
0644
edit
dl
rm
Edit:
/opt/canhelp/node_modules/kysely/dist/esm/util/require-all-props.d.ts
(1755B)
/** * Utility type to force use of all properties of T. * * Similar to Required<T> build-in type, but allows `undefined` values. */ type AllProps<T> = T & { [P in keyof T]-?: unknown; }; /** * Helper function to check listed properties according to given type. Check if all properties has been used when object is initialised. * * Example use: * * ```ts * type SomeType = { propA: string; propB?: number; } * * // propB has to be mentioned even it is optional. It still should be initialized with undefined. * const a: SomeType = requireAllProps<SomeType>({ propA: "value A", propB: undefined }); * * // checked type is implicit for variable. * const b = requireAllProps<SomeType>({ propA: "value A", propB: undefined }); * ``` * * Wrong use of this helper: * * 1. Omit checked type - all checked properties will be expect as of type never * * ```ts * type SomeType = { propA: string; propB?: number; } * // const z: SomeType = requireAllProps({ propC: "no type will work" }); // Property 'propA' is missing in type '{ propC: string; }' but required in type 'SomeType'. * ``` * * 2. Apply to spreaded object - there is no way how to check in compile time if spreaded object contains all properties * * ```ts * type SomeType = { propA: string; propB?: number; } * const y: SomeType = { propA: "" }; // valid object according to SomeType declaration * // const x = requireAllProps<SomeType>({ ...y }); // Argument of type '{ propA: string; propB?: number; }' is not assignable to parameter of type 'AllProps<SomeType>'. * ``` * * @param obj object to check if all properties has been used * @returns untouched obj parameter is returned */ export declare function requireAllProps<T>(obj: AllProps<T>): T; export {};
Save
cmd:
run