Converts everything to typescript, adding `@ts-expect-error`s where necessary. Also makes some progress converting elements to use decorators, but we're not fully there yet — I think it'll make sense to continue to do that in future PRs, rather than doing it all in one go, just so that we can keep up with the dev branch.
11 lines
254 B
TypeScript
11 lines
254 B
TypeScript
export function assertNonNullish<T>(
|
|
item: T,
|
|
itemName: string,
|
|
): asserts item is NonNullable<T> {
|
|
if (item == null) {
|
|
throw new Error(
|
|
`Variable \`${itemName}\` was expected to be defined, but found value ${item} instead`,
|
|
);
|
|
}
|
|
}
|