From 41a817a92424b87f9d3826418b8a8d65bb6973f0 Mon Sep 17 00:00:00 2001 From: Tomasz Pluskiewicz Date: Thu, 23 Jan 2020 19:03:14 +0100 Subject: [PATCH] refactor: simplify iteratee declarations (#41810) --- types/rdf-js/index.d.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/types/rdf-js/index.d.ts b/types/rdf-js/index.d.ts index a9f40705d6..2e722abf19 100644 --- a/types/rdf-js/index.d.ts +++ b/types/rdf-js/index.d.ts @@ -23,8 +23,6 @@ import { EventEmitter } from "events"; */ export type Term = NamedNode | BlankNode | Literal | Variable | DefaultGraph; -type PropType = TObj[TProp]; - /** * Contains an IRI. */ @@ -531,21 +529,21 @@ export interface Dataset extends DatasetCore { * * This method is aligned with `Array.prototype.every()` in ECMAScript-262. */ - every(iteratee: PropType, 'test'>): boolean; + every(iteratee: QuadFilterIteratee['test']): boolean; /** * Creates a new dataset with all the quads that pass the test implemented by the provided `iteratee`. * * This method is aligned with Array.prototype.filter() in ECMAScript-262. */ - filter(iteratee: PropType, 'test'>): this; + filter(iteratee: QuadFilterIteratee['test']): this; /** * Executes the provided `iteratee` once on each quad in the dataset. * * This method is aligned with `Array.prototype.forEach()` in ECMAScript-262. */ - forEach(iteratee: PropType, 'run'>): void; + forEach(iteratee: QuadRunIteratee['run']): void; /** * Imports all quads from the given stream into the dataset. @@ -562,7 +560,7 @@ export interface Dataset extends DatasetCore { /** * Returns a new dataset containing all quads returned by applying `iteratee` to each quad in the current dataset. */ - map(iteratee: PropType, 'map'>): this; + map(iteratee: QuadMapIteratee['map']): this; /** * This method calls the `iteratee` on each `quad` of the `Dataset`. The first time the `iteratee` is called, the @@ -573,7 +571,7 @@ export interface Dataset extends DatasetCore { * * This method is aligned with `Array.prototype.reduce()` in ECMAScript-262. */ - reduce(iteratee: PropType, 'run'>, initialValue?: A): A; + reduce(iteratee: QuadReduceIteratee['run'], initialValue?: A): A; /** * Existential quantification method, tests whether some quads in the dataset pass the test implemented by the @@ -583,7 +581,7 @@ export interface Dataset extends DatasetCore { * * This method is aligned with `Array.prototype.some()` in ECMAScript-262. */ - some(iteratee: PropType, 'test'>): boolean; + some(iteratee: QuadFilterIteratee['test']): boolean; /** * Returns the set of quads within the dataset as a host language native sequence, for example an `Array` in