wkrueger
wkrueger

Reputation: 1373

Typescript definition testing

Let's say I'm writing a typescript definition for a library. While I can write tests for the library runtime (its javascript output), I'd also like to write repeatable/automated tests for its typedefs, since they tend to get more complicated with the heavier use of generics, inference and sort.

I feel a bit limited on that, I'd like to write tests like: "this assignment should fail" or "this should throw a compiler error". Is there already any existing/established tool regarding that aspect?

Upvotes: 0

Views: 63

Answers (1)

basarat
basarat

Reputation: 276393

I'd like to write tests like: "this assignment should fail" or "this should throw a compiler error". Is there already any existing/established tool regarding that aspect

No. Normally tests only ensure that this assignment works and this should not throw a compiler error. That is what the tests do in DefinitelyTyped : https://github.com/DefinitelyTyped/DefinitelyTyped

Upvotes: 1

Related Questions