Re: TypeScript type definitions

Dear Laurens,

I could indeed make the termType types of each Term subtype stricter,
will do that.

Regarding the termType type of Term itself, the current spec states the following:

    Possible values include "NamedNode", "BlankNode", "Literal", "Variable" and "DefaultGraph”.

As I understand this, other implementations may therefore choose to support other values as well,
which would not conform with the following type anymore:

 `termType: 'NamedNode' | 'BlankNode' | 'Literal' | 'Variable' | 'DefaultGraph’`

I could however change it to the following:

 `termType: 'NamedNode' | 'BlankNode' | 'Literal' | 'Variable' | 'DefaultGraph’` | string

So that other values are still allowed, but the given values are simply there as a suggestion.
Any thoughts on this?

Kind regards,
Ruben Taelman

On 20 September 2017 at 11:12:17, Laurens Rietveld (laurens.rietveld@vu.nl) wrote:

I like it, good initiative. Using Typescript myself extensively as well.  A technical comment: what about making the types a bit stricter. I.e., instead of 
`termType: string`, 
using 
`termType: 'NamedNode' | 'BlankNode' | 'Literal' | 'Variable' | 'DefaultGraph'`

gr Laurens

On Wed, Sep 20, 2017 at 11:03 AM, Ruben Taelman <ruben.taelman@ugent.be> wrote:
Dear all,

Some people (including myself) prefer using typed Javascript, using TypeScript for instance.

As I was not able to find any type definitions for the RDFJS interfaces,
I’ve implemented these myself here:
https://github.com/rubensworks/DefinitelyTyped/commit/44292d468be8893f589a1ee4a76dd8d50b588ce3

Before I make a PR with these types to the DefinitelyTyped repo,
so that these types would become available as `@types/rdf-js`,
I first want to make sure everyone here agrees with this implementation.

The JSDoc has been taken directly from the spec.

Any feedback or comments are welcome!

Kind regards,
Ruben Taelman



--
VU University Amsterdam
Faculty of Exact Sciences
Department of Computer Science
De Boelelaan 1081 A
1081 HV Amsterdam
The Netherlands
www.laurensrietveld.nl
laurens.rietveld@vu.nl

Visiting address: 
De Boelelaan 1081
Science Building Room T312

Received on Wednesday, 20 September 2017 09:22:33 UTC