feat: check type in return of `resolveShader`
lajbel opened this issue · comments
function resolveShader(
src: RenderProps["shader"],
): ShaderData | Asset<ShaderData> | null {
if (!src) {
return gfx.defShader;
}
if (typeof src === "string") {
const shader = getShader(src);
if (shader) {
return shader.data ?? shader;
} else if (loadProgress() < 1) {
return null;
} else {
throw new Error(`Shader not found: ${src}`);
}
} else if (src instanceof Asset) {
return src.data ? src.data : src;
}
// TODO: check type
// @ts-ignore
return src;
}
To do it I have to remove type duplication between types.ts
and other modules, also rework in declaration files generation