chore: refactoring type test #27
                
     Merged
            
            
          
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
This PR slightly improves type tests (as well as type definitions) and updates
tstycheto latest beta. The release notes are here: https://tstyche.org/releases/tstyche-5I would recommend testing types using most challenging compiler option. For instance, enabling
exactOptionalPropertyTypesandnoUncheckedIndexedAccessreveals some issues with type definitions. I have fixed these, of course.Might be enabling these options was not possible with
[email protected]. It was checking source files using the same TSConfig. That is too much, becausetscdoes that job already. This behaviour is removed in TSTyche 5. Now only the.d.tsfiles are checked.I would also recommend avoiding brackets notation when testing types of properties. The brackets notation does not allow checking wherever a property is marker optional or readonly. And it adds
| undefinedto type of each property. Try playing with theAsyncMessagetype (that I had to fix after refactoring the test).And final news! The
.tobeCallableWith()matcher now can be used to test types as per your request (tstyche/tstyche#592). This change was just published today (not yet documented, I was rushing because of my vacation).The following example you provided, now works as expected:
Not included in this PR. Left it for you to try out (;