These are chat archives for DefinitelyTyped/DefinitelyTyped

16th
Nov 2016
Cody Mullins
@codymullins
Nov 16 2016 01:45
How would I add to an existing typings file locally in my project?
Pat Sissons
@patsissons
Nov 16 2016 01:46
you mean augment an existing file containing type definitions that is not within your source base?
Cody Mullins
@codymullins
Nov 16 2016 01:47
yes
Pat Sissons
@patsissons
Nov 16 2016 01:47
depending on how you are augmenting you'll want to start with one of these: https://www.typescriptlang.org/docs/handbook/declaration-files/templates.html
likely it will be the module plugin template
from there, you just need to import the augmentation file from somewhere in your code
Cody Mullins
@codymullins
Nov 16 2016 01:49
What determines which I would use?
Pat Sissons
@patsissons
Nov 16 2016 01:49
depends on they type of module you are augmenting and what augmentations you want to perform
you can merge declarations (add new properties or functions to existing classes and interfaces)
Cody Mullins
@codymullins
Nov 16 2016 01:51
I essentially just want to be able to add a rule to the validation definitions: ko.validation.rules['myRule'] - the current typings file has them as not an array so I can't do the above with "no implicit any" turned on.
Pat Sissons
@patsissons
Nov 16 2016 01:51
or you can modify existing functionality (which is a bit of a different case)
no implicit any just enforces implicit any's you can always explicitly type something
i.e.
(<any>ko.validation.rules)['myRule'] = rule;
Cody Mullins
@codymullins
Nov 16 2016 01:53
perfect
that saves me the trouble of my initial question, but this is still good to know
I had it backwards when I tried before
thank you
on another note...do you know if the npm install @types issues got worked out? Last I tried to migrate to using it, things backfired on me
but that was a day or two after
Pat Sissons
@patsissons
Nov 16 2016 02:01
I can say they are working for me now
if you have duplicate type issues you likely just need to purge your existing typings
Cody Mullins
@codymullins
Nov 16 2016 02:02
cool. will give it a try again in a few days.
thank you for your help
Pat Sissons
@patsissons
Nov 16 2016 02:02
more disclosure, i use a mix of @types and pre-packaged types (i.e. rxjs and moment)
and also some custom types which I have not yet published to @types
Cody Mullins
@codymullins
Nov 16 2016 02:07
what do you mean by pre-packaged types?
Pat Sissons
@patsissons
Nov 16 2016 02:20
Some npm packages publish their typings as well, there is a new section in packages.json to relay its relative path
Cody Mullins
@codymullins
Nov 16 2016 02:20
ah
I didn't know moment had that
nice
actually, I guess I did. I don't have a moment typings and have been using it.
Pat Sissons
@patsissons
Nov 16 2016 02:23
Yea ideally all typings work this way, but in reality many typings are written by someone other than the author of the package
Dominic Watson
@intellix
Nov 16 2016 22:40
so I'm updating the GraphQL types and they're ancient. Currently 0.7.0 and there's 0.8.2 out
I've created a PR which brings 0.7.0 to 0.7.2
should I create multiple PRs to do 0.7.2 -> 0.7.3 -> 0.7.4 etc or put them in the same PR?
Pat Sissons
@patsissons
Nov 16 2016 22:48
i think it would make sense to put them in the same PR, but that's just my opinion
incremental commits in the PR for the various versions seems like enough visibility of the incoming changes
Dominic Watson
@intellix
Nov 16 2016 22:53
also, I'm seeing a few functions that aren't exported, yet there are others which aren't exported and not included
any point in including functions which aren't exported by the module?
there's type information there, with comments etc, but they're just not exported
Dominic Watson
@intellix
Nov 16 2016 22:59
quite a few un-exported items, it makes me wonder if the initial version was wrong or I'm missing something