|
|
|
|
|
by jbreckmckye
1460 days ago
|
|
Hey Mark, I’m actually currently looking at a similar problem. I’m writing a HTTP client based on composition. The exact details aren’t important, but one of the goals is to have a strong type system for describing a valid pipeline of things like response parsers. Imagine something like Doing “type tests” alone isn’t too hard - we can just use conditional types and the extends keyword. If the code compiles, fine. But the harder part is negative type tests. “Given this code, the developer should get this error from TSC”. But this is just as important a part of the API; your types are there to convince the consumer that they can call a type-checked API with confidence. In theory it should be plausible to run TSC programmatically. The issue is that TypeScript’s ScriptProcessor API really wants to be called with files on the filesystem rather than source text. So I am having to do some bodging. If I can get something sorted I may write a repo to demo it, I think it is a common problem. |
|
https://github.com/phryneas/remark-typescript-tools