nitro-codegen
Version:
The code-generator for react-native-nitro-modules.
13 lines (12 loc) • 391 B
JavaScript
import { NamedWrappingType } from './NamedWrappingType.js';
export function getTypeAs(type, classReference) {
if (type instanceof classReference) {
return type;
}
else if (type instanceof NamedWrappingType) {
return getTypeAs(type.type, classReference);
}
else {
throw new Error(`Type of kind "${type.kind}" is not a ${classReference}!`);
}
}