Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Bug: import, some, forEach and every do not fully align with Dataset interface #435

Open
jeswr opened this issue Sep 5, 2024 · 0 comments

Comments

@jeswr
Copy link
Collaborator

jeswr commented Sep 5, 2024

Discovered when trying to update @rdfjs/types (attempt here). The error log when trying to make the Store implement the Dataset interface is:

  288:5  error  TypeScript@4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7 compile error: 
Property 'import' in type 'Store<Q_RDF, Q_N3, OutQuad, InQuad>' is not assignable to the same property in base type 'Dataset<OutQuad, InQuad>'.
  Type '(stream: Stream<Q_RDF>) => EventEmitter<DefaultEventMap>' is not assignable to type '(stream: Stream<InQuad>) => Promise<this>'.
    Types of parameters 'stream' and 'stream' are incompatible.
      Type 'Stream<InQuad>' is not assignable to type 'Stream<Q_RDF>'.
        Type 'InQuad' is not assignable to type 'Q_RDF'.
          'InQuad' is assignable to the constraint of type 'Q_RDF', but 'Q_RDF' could be instantiated with a different subtype of constraint 'BaseQuad'  @definitelytyped/expect
  315:5  error  TypeScript@4.8, 4.9, 5.0 compile error: 
Property 'forEach' in type 'Store<Q_RDF, Q_N3, OutQuad, InQuad>' is not assignable to the same property in base type 'Dataset<OutQuad, InQuad>'.
  Type '(callback: QuadCallback<Q_N3>, subject: OTerm, predicate: OTerm, object: OTerm, graph: OTerm) => void' is not assignable to type '(callback: (quad: OutQuad, dataset: this) => void) => void'                                                                                                                                                                                                                                                                                                                               @definitelytyped/expect
  315:5  error  TypeScript@5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7 compile error: 
Property 'forEach' in type 'Store<Q_RDF, Q_N3, OutQuad, InQuad>' is not assignable to the same property in base type 'Dataset<OutQuad, InQuad>'.
  Type '(callback: QuadCallback<Q_N3>, subject: OTerm, predicate: OTerm, object: OTerm, graph: OTerm) => void' is not assignable to type '(callback: (quad: OutQuad, dataset: this) => void) => void'.
    Target signature provides too few arguments. Expected 5 or more, but got 1                                                                                                                                                                                                                           @definitelytyped/expect
  316:5  error  TypeScript@4.8, 4.9, 5.0 compile error: 
Property 'every' in type 'Store<Q_RDF, Q_N3, OutQuad, InQuad>' is not assignable to the same property in base type 'Dataset<OutQuad, InQuad>'.
  Type '(callback: QuadPredicate<Q_N3>, subject: OTerm, predicate: OTerm, object: OTerm, graph: OTerm) => boolean' is not assignable to type '(iteratee: (quad: OutQuad, dataset: this) => boolean) => boolean'                                                                                                                                                                                                                                                                                                                       @definitelytyped/expect
  316:5  error  TypeScript@5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7 compile error: 
Property 'every' in type 'Store<Q_RDF, Q_N3, OutQuad, InQuad>' is not assignable to the same property in base type 'Dataset<OutQuad, InQuad>'.
  Type '(callback: QuadPredicate<Q_N3>, subject: OTerm, predicate: OTerm, object: OTerm, graph: OTerm) => boolean' is not assignable to type '(iteratee: (quad: OutQuad, dataset: this) => boolean) => boolean'.
    Target signature provides too few arguments. Expected 5 or more, but got 1                                                                                                                                                                                                                   @definitelytyped/expect
  317:5  error  TypeScript@4.8, 4.9, 5.0 compile error: 
Property 'some' in type 'Store<Q_RDF, Q_N3, OutQuad, InQuad>' is not assignable to the same property in base type 'Dataset<OutQuad, InQuad>'.
  Type '(callback: QuadPredicate<Q_N3>, subject: OTerm, predicate: OTerm, object: OTerm, graph: OTerm) => boolean' is not assignable to type '(iteratee: (quad: OutQuad, dataset: this) => boolean) => boolean'                                                                                                                                                                                                                                                                                                                        @definitelytyped/expect
  317:5  error  TypeScript@5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7 compile error: 
Property 'some' in type 'Store<Q_RDF, Q_N3, OutQuad, InQuad>' is not assignable to the same property in base type 'Dataset<OutQuad, InQuad>'.
  Type '(callback: QuadPredicate<Q_N3>, subject: OTerm, predicate: OTerm, object: OTerm, graph: OTerm) => boolean' is not assignable to type '(iteratee: (quad: OutQuad, dataset: this) => boolean) => boolean'.
    Target signature provides too few arguments. Expected 5 or more, but got 1
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant