/
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/type-utils.d.ts
(6095B)
import type { InsertResult } from '../query-builder/insert-result.js'; import type { DeleteResult } from '../query-builder/delete-result.js'; import type { UpdateResult } from '../query-builder/update-result.js'; import type { KyselyTypeError } from './type-error.js'; import type { MergeResult } from '../query-builder/merge-result.js'; /** * Given a database type and a union of table names in that db, returns * a union type with all possible column names. * * Example: * * ```ts * interface Person { * id: number * } * * interface Pet { * name: string * species: 'cat' | 'dog' * } * * interface Movie { * stars: number * } * * interface Database { * person: Person * pet: Pet * movie: Movie * } * * type Columns = AnyColumn<Database, 'person' | 'pet'> * * // Columns == 'id' | 'name' | 'species' * ``` */ export type AnyColumn<DB, TB extends keyof DB> = { [T in TB]: keyof DB[T]; }[TB] & string; /** * Extracts a column type. */ export type ExtractColumnType<DB, TB extends keyof DB, C> = { [T in TB]: C extends keyof DB[T] ? DB[T][C] : never; }[TB]; /** * Given a database type and a union of table names in that db, returns * a union type with all possible `table`.`column` combinations. * * Example: * * ```ts * interface Person { * id: number * } * * interface Pet { * name: string * species: 'cat' | 'dog' * } * * interface Movie { * stars: number * } * * interface Database { * person: Person * pet: Pet * movie: Movie * } * * type Columns = AnyColumnWithTable<Database, 'person' | 'pet'> * * // Columns == 'person.id' | 'pet.name' | 'pet.species' * ``` */ export type AnyColumnWithTable<DB, TB extends keyof DB> = { [T in TB]: `${T & string}.${keyof DB[T] & string}`; }[TB]; /** * Just like {@link AnyColumn} but with a ` as <string>` suffix. */ export type AnyAliasedColumn<DB, TB extends keyof DB> = `${AnyColumn<DB, TB>} as ${string}`; /** * Just like {@link AnyColumnWithTable} but with a ` as <string>` suffix. */ export type AnyAliasedColumnWithTable<DB, TB extends keyof DB> = `${AnyColumnWithTable<DB, TB>} as ${string}`; /** * Extracts the item type of an array. */ export type ArrayItemType<T> = T extends ReadonlyArray<infer I> ? I : never; export type SimplifySingleResult<O> = O extends InsertResult ? O : O extends DeleteResult ? O : O extends UpdateResult ? O : O extends MergeResult ? O : Simplify<O> | undefined; export type SimplifyResult<O> = O extends InsertResult ? O : O extends DeleteResult ? O : O extends UpdateResult ? O : O extends MergeResult ? O : Simplify<O>; export type Simplify<T> = DrainOuterGeneric<{ [K in keyof T]: T[K]; } & {}>; /** * Represents a database row whose column names and their types are unknown. */ export type UnknownRow = Record<string, unknown>; /** * Makes all properties of object type `T` nullable. */ export type Nullable<T> = { [P in keyof T]: T[P] | null; }; /** * Evaluates to `true` if `T` is `never`. */ export type IsNever<T> = [T] extends [never] ? true : false; /** * Evaluates to `true` if `T` is `any`. */ export type IsAny<T> = 0 extends T & 1 ? true : false; /** * Evaluates to `true` if the types `T` and `U` are equal. */ export type Equals<T, U> = (<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2 ? true : false; export type NarrowPartial<O, T> = DrainOuterGeneric<T extends object ? { [K in keyof O & string]: K extends keyof T ? T[K] extends NotNull ? Exclude<O[K], null> : T[K] extends O[K] ? T[K] : KyselyTypeError<`$narrowType() call failed: passed type does not exist in '${K}'s type union`> : O[K]; } : never>; /** * A type constant for marking a column as not null. Can be used with `$narrowPartial`. * * Example: * * ```ts * import type { NotNull } from 'kysely' * * await db.selectFrom('person') * .where('nullable_column', 'is not', null) * .selectAll() * .$narrowType<{ nullable_column: NotNull }>() * .executeTakeFirstOrThrow() * ``` */ export type NotNull = { readonly __notNull__: unique symbol; }; export type SqlBool = boolean | 0 | 1; /** * Utility to reduce depth of TypeScript's internal type instantiation stack. * * Example: * * ```ts * type A<T> = { item: T } * * type Test<T> = A< * A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<T>>>>>>>>>>>>>>>>>>>>>>>> * > * * // type Error = Test<number> // Type instantiation is excessively deep and possibly infinite.ts (2589) * ``` * * To fix this, we can use `DrainOuterGeneric`: * * ```ts * type A<T> = DrainOuterGeneric<{ item: T }> * * type Test<T> = A< * A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<T>>>>>>>>>>>>>>>>>>>>>>>> * > * * type Ok = Test<number> // Ok * ``` */ export type DrainOuterGeneric<T> = [T] extends [unknown] ? T : never; export type ShallowRecord<K extends keyof any, T> = DrainOuterGeneric<{ [P in K]: T; }>; /** * Dehydrates any root properties of an object that are not valid JSON types. * * For now, we catch anything in {@link StringsWhenDataTypeNotAvailable} and convert it to `string`. */ export type ShallowDehydrateObject<O> = { [K in keyof O]: ShallowDehydrateValue<O[K]>; }; /** * Dehydrates a value when it is not a valid JSON type. * * For now, we catch anything in {@link StringsWhenDataTypeNotAvailable} and convert it to `string`, * and anything in {@link NumbersWhenDataTypeNotAvailable} and convert it to `number`. */ export type ShallowDehydrateValue<T> = T extends null | undefined ? T : '__kysely_dehydrate__' extends keyof NonNullable<T> ? T : T extends (infer U)[] | null | undefined ? Array<ShallowDehydrateValue<U>> | Extract<T, null | undefined> : Exclude<T, StringsWhenDataTypeNotAvailable | NumbersWhenDataTypeNotAvailable> | ([Extract<T, NumbersWhenDataTypeNotAvailable>] extends [never] ? never : number) | ([Extract<T, StringsWhenDataTypeNotAvailable>] extends [never] ? never : string); export type StringsWhenDataTypeNotAvailable = Date | Uint8Array; export type NumbersWhenDataTypeNotAvailable = bigint | NumericString; export type NumericString = `${number}`;
Save
cmd:
run