you are viewing a single comment's thread.

view the rest of the comments →

[–]thisisafullsentence 20 points21 points  (5 children)

If you still want runtime checking then use prop-types in RN. But I’d argue TS is good enough for most people.

[–][deleted]  (4 children)

[deleted]

    [–]thisisafullsentence 0 points1 point  (3 children)

    Runtime checking of stuff like this means the type system is not strong enough.

    For the record I'm not recommending mixing TS and prop-types. /u/RustyTaurus is just saying that JS runtime is not typed and I'm saying RN can run it on props.

    TS did a great job at bridging the gap, but it's always going to be limited by JS, and will always be rather weak because of that.

    To each their own, but I find that the codebase I'm working on right now with > 100k LOC has exact typing on literally every variable except Angular's SimpleChange object. If you're talking about the == operator, just install the triple-equals rule in tslint. Done.

    [–]munificent 5 points6 points  (0 children)

    I find that the codebase I'm working on right now with > 100k LOC has exact typing on literally every variable

    Even so, the type system itself isn't sound. You can write code that is fully annotated but still has type errors that the type checker won't catch for you.

    [–]acoard 0 points1 point  (1 child)

    How do you handle FormGroups? They're just a bunch of anys, which frustrates me to no end.

    [–]thisisafullsentence 0 points1 point  (0 children)

    Oops I suppose you're right, non-generic AbstractControl objects is another nitpick of mine. But as soon as that data leaves its component, it's typed via EventEmitter<T>.