Add dtslint setup to validate type definitions#98
Closed
kohlmannj wants to merge 3 commits intodevelopit:masterfrom
Closed
Add dtslint setup to validate type definitions#98kohlmannj wants to merge 3 commits intodevelopit:masterfrom
kohlmannj wants to merge 3 commits intodevelopit:masterfrom
Conversation
I’ve disabled a few of the standard dtslint rules for the moment. The goal of this commit is to have dstlint’s error output match just the two TypeScript errors I had encountered in Unistore v3.0.6.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
connects #96, #97, #99, #100, #101, #102
Description
I'm really excited to start using Unistore within a TypeScript project! However, when I installed Unistore and started using its type definitions, I noticed two errors when reviewing
preact.d.tsandreact.d.tsin Visual Studio Code (using TypeScript v2.9.2): #96, #97To avoid issues with Unistore's type definitions in the future, I've added an additional test command to validate the type definitions using dtslint.
Q&A
Why "TypeScript Version: 2.2"? Evidently these type definitions as written rely upon some feature introduced in TS 2.2. dtslint recommended this addition when I tried running it without the
// TypeScript Version: 2.2comments:dtslint Error without TypeScript Version Comments
Why are some of dtslint's rules disabled in tslint.json? My goal in this PR is to have dtslint's error output contain exactly these two errors. Future PRs might improve the type definitions by re-enabling these disabled rules.
Why are
preactandreactin tsconfig.json’spathsconfig? First, I set the path tounistoreso that dtslint resolvesindex.d.tsfor the module name”unistore”. (dtslint recommends doing this in their docs.) That caused”preact”and”react”to incorrectly resolve to the two localpreact.d.tsandreact.d.tsfiles, however. Hence, I explicitly set paths to them (though I wonder if the”react”path should benode_modules/reactinstead?).Why is CI failing for this PR? CI fails right now because of the added
dtslintinvocation in thetestscript. As described above, this is symptomatic of now testing something previously untested. We can resolve this by merging fixes for both #96 and #97.Notes
I'm not sure what's wrong with the Preact definitions in #96, so I cannot help there.
However, #97 was super easy, so I've opened #99 as well.