gristlabs / ts-interface-checker

Runtime library to validate data against TypeScript interfaces.
Apache License 2.0
323 stars 18 forks source link

Uncaught TypeError: r is not a function #32

Open gusarov opened 4 years ago

gusarov commented 4 years ago

It all works in development mode, but fails in prod, even ng serve --prod

main.3373bd908bf1d098cd2f.js:1 Uncaught TypeError: r is not a function
    at e.createCheckers (main.3373bd908bf1d098cd2f.js:1)
    at Module.zUnb (main.3373bd908bf1d098cd2f.js:1)
    at l (runtime.8fbc2fd6f12647d93e24.js:1)
    at Object.0 (main.3373bd908bf1d098cd2f.js:1)
    at l (runtime.8fbc2fd6f12647d93e24.js:1)
    at t (runtime.8fbc2fd6f12647d93e24.js:1)
    at Array.r [as push] (runtime.8fbc2fd6f12647d93e24.js:1)
    at main.3373bd908bf1d098cd2f.js:1

My code is:

import { UserProfile } from '../_model/userProfile';
import { createCheckers } from 'ts-interface-checker';
const { UserProfile } = createCheckers(todoUserTI, userProfileTI);

and *TI files are generated from the model

"ts-interface-checker": "^0.1.13",
"ts-interface-builder": "^0.2.2",
dsagal commented 3 years ago

Did you figure this out? If there is a difference between dev and prod, that seems likely a build-related issue. From your example, I can't tell what todoUserTI and userProfileTI are, but it sounds like in prod they are not what they are supposed to be.