-
Notifications
You must be signed in to change notification settings - Fork 16
feat: add typedef generation #56
Conversation
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [12.x] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason to stick with 12.x, can we bump to 14.x to future proof this a bit more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I honestly wish there was a way to stay whatever the current stable version is, but I can't find a way to do that. Chose 12.x because it's actually newer that 10.x
used here and current LTS. Happy to put whatever makes most sense.
Please note that this just runs the typescript not any of the code here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, so I think 14.x is going to be the best bet here, it's got a much longer life than 12.x ahead of it and is 2 weeks away from being LTS so we may as well start using it in places like this. up to you though.
The labels thing has been an ongoing discussion for a while for setup-node with folks wanting it to copy the nvm style so we could do the same things that we could do with travis, alas no serious movement: actions/setup-node#26
static isBlock (other) { // eslint-disable-line no-unused-vars | ||
// implemented by class-is module | ||
static isBlock (other) { | ||
return Boolean(other && other[blockSymbol]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe just return other && other[blockSymbol] === true
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rvagg I'm afraid TS will complain because null && v
is null
and not a boolean
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
urgh, that's kind of gross, return !!other && other[blockSymbol] === true
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sgtm, and +1 to removal of class-is to simplify
Codecov Report
@@ Coverage Diff @@
## master #56 +/- ##
===========================================
+ Coverage 85.71% 96.55% +10.83%
===========================================
Files 1 1
Lines 14 29 +15
===========================================
+ Hits 12 28 +16
+ Misses 2 1 -1
Continue to review full report at Codecov.
|
Main goal of this pull request is to start generating typescript typedefs from the jsdocs so that dependent libraries can take advantage of them out of the box. Mainly I'd like this to get better types in js-ipfs (see ipfs/js-ipfs#3281)
This pull request does a little bit more though:
class-is
dependency provides little value but complicates things for both type generation and otherwise.data
andcid
getters to readonly properties (just like we did successfully in Backwards compatible pure data model API js-ipld-dag-pb#184)_data
and_cid
fields to deprecated getters that will start throwing after next major version bump.