These are chat archives for rdfjs/public

May 2018
Ruben Verborgh
May 27 2018 11:27
@mattrayner Would be nice indeed. @bergos You guys doing TypeScript?
Thomas Bergwinkl
May 27 2018 14:52
@RubenVerborgh we don't do typescript and also don't have plans
@RubenVerborgh @mattrayner will we have a package like in rdfjs? than i think that would be the right place for it.
Austin Wright
May 27 2018 20:08
@mattrayner What are you trying to do?
Matt Rayner
May 27 2018 22:23

@awwright I’m using N3 in a couple of TypeScript projects at the moment, adding definitions would allow me to ensure the code I’m writing meets the spec of the library - parameter types, return value types, method signatures etc.

@phreed describes it well in the initial issue:

`== The typings offer a partial formal specification for the API ==

Even if you do not make use of TypeScript the definitions can provide
additional hints as to how the API is intended to be used.

Consider something as simple as the 'Util.createLiteral()' function.
Does it take one argument or two?
Does the type of the first argument matter?
What are the valid values of the second argument? is it just a string?

Most of these questions are answered in your documentation but they can be
partially answered in a formal way in the TypeScript definitions.
Therefore typings are a form of documentation.`

If this isn’t a route you’d like to go, I can contribute a third party definitionto somewhere like DefinitelyTyped - it’s just a bit meh :smile:
Austin Wright
May 27 2018 22:43
@mattrayner How good is TypeScript at figuring out function domains? I use a lot of if(typeof argName!='string') throw new TypeError();
Which should imply the domain of that argument is a string