rdfjs / types

Authoritative TypeScript typings for all RDFJS specifications
MIT License
17 stars 13 forks source link

Migrate typings away from DefinitelyTyped #1

Closed blake-regalia closed 3 years ago

blake-regalia commented 3 years ago

The RDFJS typings should be maintained and published by the RDFJS organization. Some of the issues with hosting the typings on DefinitelyTyped are:

Several libraries are currently using the de facto @types/rdf-js package for importing RDFJS interface types. Open question is whether or not DT/TypeScript will allow upgrading this package so that it simply acts as a proxy for new @rdfjs/types package by importing and exporting it.

tpluscode commented 3 years ago

For reference, DT or DefinitelyTyped is this repository: https://github.com/DefinitelyTyped/DefinitelyTyped

RubenVerborgh commented 3 years ago

+1 for taking control

Open question is whether or not DT/TypeScript will allow upgrading this package so that it simply acts as a proxy for new @rdfjs/types package by importing and exporting it.

If not, we deprecate.

rubensworks commented 3 years ago

I think the safest option would be to make this repo a clone of DT where we accept (and discuss) changes to the RDF/JS typings, and push to the upstream DT when we reach a consensus.

While I agree that @rdfjs/types would be a much cleaner solution, the convention of using DT (and @types/* packages) may lead to unforeseen problems in the future.

At the moment I don't know of any specific problems that would occur, but I can for example imagine that there could be linting tools that have special behaviour when they encounter @types/* packages, and would therefore misbehave on @rdfjs/types.

tpluscode commented 3 years ago

On a closer look maybe it would not be as troublesome, at least for package consumers. Right now the types package pretends to describe rdf-js. A package which indeed do exist on NPM

I think that the path of least resistance is to revive that package and remove @types/rdf-js from DT. Any existing import {} from 'rdf-js' should just work because typescript tries to resolve *.d.ts files in the same way it resolves other modules, if I understand this correctly.

The issue I found is on the end of any @types/ packages which depend on the current @types/rdf-js. According to the readme of DT any package can actually have package.json dependencies to "real" packages with types. The only nuisance is that any such package has to be explicitly added to allowedPackageJsonDependencies.txt in DefinitelyTyped-tools.

alexkreidler commented 3 years ago

Hey all,

I think reviving the rdf-js package would definitely mean most people don't have to find and replace their existing imports. We could add a depracation notices to @types/rdf-js, and existing libraries would get a notice but still work.

However this could lead to incompatibility if we make updates to the new types and a package is using the old ones. Thus I think "ripping the band-aid off" might be thee best option. That could entail either

Regardless, I think its great that we're moving to our own repo so we can keep the types consistent with the spec and implement more consistent versioning. I personally have several times experience TS errors when using packages that depend on @types/rdf-js version 3 vs version 4, so I'm very hopeful this will improve interoperability.