deen
deen
CCConvex Community
Created by deen on 11/30/2024 in #support-community
nullThrows has wrong type or jsdoc
/**
* Filters out null elements from an array.
* @param list List of elements that might be null.
* @returns List of elements with nulls removed.
*/
export function pruneNull<T>(list: (T | null)[]): T[] {
return list.filter((i) => i !== null) as T[];
}

export class NullDocumentError extends Error {}

/**
* Throws if there is a null element in the array.
* @param list List of elements that might have a null element.
* @returns Same list of elements with a refined type.
*/
export function nullThrows<T>(doc: T | null, message?: string): T {
if (doc === null) {
throw new NullDocumentError(message ?? "Unexpected null document.");
}
return doc;
}
/**
* Filters out null elements from an array.
* @param list List of elements that might be null.
* @returns List of elements with nulls removed.
*/
export function pruneNull<T>(list: (T | null)[]): T[] {
return list.filter((i) => i !== null) as T[];
}

export class NullDocumentError extends Error {}

/**
* Throws if there is a null element in the array.
* @param list List of elements that might have a null element.
* @returns Same list of elements with a refined type.
*/
export function nullThrows<T>(doc: T | null, message?: string): T {
if (doc === null) {
throw new NullDocumentError(message ?? "Unexpected null document.");
}
return doc;
}
nullThrows checks a single item, despite indicating it works with a list. PS: If anyone dives into the helpers repo, there's a typo in the readme: Sessions: client-generatead
1 replies
CCConvex Community
Created by deen on 7/3/2024 in #support-community
convex-ents DataModel type "never" under convex 1.13.0
The generated DataModel type contains only never for each table. This is with convex 1.13.0, convex-ents 0.7.7, and convex-helpers 0.1.45, currently the latest versions of each package. The issue is reproducible in saas-starter after cloning and upgrading dependancies.
9 replies