Commit 488664af authored by Lyza Danger Gardner's avatar Lyza Danger Gardner Committed by Lyza Gardner

Add typing utility module

Add a typing utility module with a helper function to "cast" the input
so that TS understands that it is not null/undefined. This is useful
in situations where logic would prevent a reference from being empty
but TS can't follow that logic.
parent ef3e5577
/**
* Helper function for cases in which logically a reference is definitely
* not nullish, but TS can't infer that correctly. This will cast the `arg`
* and appease type-checking.
*
* @template T
* @param {T} arg
*/
export function notNull(arg) {
return /** @type {NonNullable<T>} */ (arg);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment