rrdelaney / ReasonablyTyped

:diamond_shape_with_a_dot_inside: Converts Flow and TypeScript definitions to Reason interfaces
https://rrdelaney.github.io/ReasonablyTyped/
MIT License
518 stars 24 forks source link

Add test suite for DefinitelyTyped #22

Closed fstoerkle closed 7 years ago

fstoerkle commented 7 years ago

As suggested in #20, this adds a new test suite for testing the compilation of all type definitions in DefinitelyTyped, in the same way as flow-typed is currently tested.

The implementation is pretty much the same as for flow-typed, some code is even duplicated. Please let me know if you want me to refactor/clean that up, or if you are fine with it as is for now.

Note: A test run for compiling all DefinitelyTyped types (currently 7744!) takes a while (~ 10 minute on my MacBook)

For the output from node docs/find-error.js see below:

29  StringLiteral is not currently supported
19  Unknown type when converting to Bucklescript type
17  Type parameter bounds is not currently supported
17  Unknown statement type when parsing libdef
11  Intersection types is not currently supported
10  NumberLiteral is not currently supported
10  BooleanLiteral is not currently supported
9  Unknown declaration when converting a module property declaration
9 SYNTAX ERROR
8  static CallProperty on Object types is not currently supported
7  Indexer on Object types is not currently supported
6  Unknown declaration type when converting a module declaration
4  Typeof can only operate on variable declarations
4  Built-in type $Subtype is not currently supported
2  Inheriting in interfaces is not currently supported
2  Built-in type $Exports is not currently supported
2  Type parameter variance is not currently supported
1  Built-in type $npm$dropzone$FilesToString is not currently supported
1  Built-in type $npm$currencyFormatter$Currency is not currently supported
1  Built-in type $npm$MersenneTwister is not currently supported
1  Built-in type $npm$pad$options is not currently supported
1  Unknown identifier
1  Built-in type $npm$parse$Parse is not currently supported
1  Built-in type $npm$color$RGBObject is not currently supported
1  Built-in type $npm$styledComponents$Interpolation is not currently supported
rrdelaney commented 7 years ago

Thanks so much, this looks great! Ignore the CircleCI build failing for now, that's my fault (broken cache).

I can't test this right now, but I'll pull later tonight and check out the results from the test runs

Thanks again 😄 this is great to test against even more libraries

rrdelaney commented 7 years ago

I updated the find-error.js script to get test results from DT, so many errors haha!

2190 SYNTAX ERROR
1542  undefined
1076  Unknown identifier
500  Unknown declaration when converting a module property declaration 
340  Typeof can only operate on variable declarations
316  typeof can only operate on classes
267  Intersection types is not currently supported 
41  StringLiteral is not currently supported 
34  Indexer on Object types is not currently supported 
20  Unknown type when converting to Bucklescript type 
17  Unknown statement type when parsing libdef 
17  Type parameter bounds is not currently supported 
16  NumberLiteral is not currently supported 
10  BooleanLiteral is not currently supported 
8  static CallProperty on Object types is not currently supported 
6  Unknown declaration type when converting a module declaration 
4  Built-in type $Subtype is not currently supported 
4  Promise must have exactly one type parameter. Found none.
3  Non-string as object property should not happen 
3 TypeError: Cannot read property '1' of undefined
2  Inheriting in interfaces is not currently supported 
2  Type parameter variance is not currently supported 
2  Built-in type $Exports is not currently supported 
1  Array with more than one type is not currently supported 
1  Built-in type $npm$dropzone$FilesToString is not currently supported 
1  Built-in type $npm$currencyFormatter$Currency is not currently supported 
1  Built-in type $npm$MersenneTwister is not currently supported 
1  Built-in type $npm$pad$options is not currently supported 
1  Built-in type $npm$color$RGBObject is not currently supported 
1  Built-in type $npm$parse$Parse is not currently supported 
1 TypeError: Cannot read property 'text' of undefined
1  Built-in type $script is not currently supported 
1 RangeError: Maximum call stack size exceeded
1 TypeError: Cannot read property 'c' of undefined
1  Built-in type $npm$styledComponents$Interpolation is not currently supported 
fstoerkle commented 7 years ago

Nice! 🎉

Yes, there are indeed a lot of errors ;)

One note: I think you ran prettier also over the git submodule src/__tests__/definitely-typed. Was that intended? I guess it will make updating the submodule complicated, since you have local changes...