3 ms·
Progressive typing of an untyped code base. Types that are too complex to represent in that type system.
by phyrex 2y ago
Progressive typing of an untyped code base. Types that are too complex to represent in that type system.
- t-writescode 2y ago* Common functions such as parsing functions in languages that don't support function overloading * "equals" and other global functions.
- shepherdjerred 2y agoTypescript have solutions for both of those problems: conditional types and generics
- ervine 2y agoYep, adopting strict after the fact is a different conversation, but one that has been talked about a bunch and there is even tooling to support progressive adoption. Types that are too complex... hmmmm - I'm sure this exists in domains other than the bullshit CRUD apps I write. So yeah, I guess I don't know what I don't know here. I've written some pretty crazy types though, not sure what TypeScript is unable to represent.
- mikepurvis 2y agoProgressive code QA in general is IMO an underexplored space. Thankfully linters have now largely given way to opinionated formatters (xfmt, black, clang-format) but in the olden days I wished there was a way to check in a parallel exemptions file that could be periodically revised downward but would otherwise function as a line in the sand to at least prevent new violations from passing the check. I'd be interested in similar capabilities for higher-level tools like static analyzers and so on. The point is not to carry violations long term, but to be able to burn down the violations over time in parallel to new development work.
- nemetroid 2y agoThis is how we introduced and work with clang-tidy. We enabled everything we eventually want to have, then individually disabled currently failing checks. Every once in a while, someone fixes an item and removes it from the exclusion list. The list is currently at about half the length we started out with.
- prmph 2y ago> not sure what TypeScript is unable to represent. I want a type that represents a string of negative prime numbers alternating with palindromes, separated by commas.
- ervine 2y agoOh yeah, you have to get into branded types for this I think, which means a parsing step. Fair point.
- sesm 2y agoImportant note: TS doesn't let you enable strict mode on per-file basis. Flow allowed that.