Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#68117 fix: missing factory parameter by @t…
Browse files Browse the repository at this point in the history
…pluscode

* fix: missing factory parameter

* style: pretty print

* style: format
  • Loading branch information
tpluscode authored Jan 9, 2024
1 parent bf9914f commit fba2208
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
13 changes: 13 additions & 0 deletions types/clownface/clownface-tests.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import DataFactory from "@rdfjs/data-model/Factory.js";
import DatasetFactory from "@rdfjs/dataset/Factory.js";
import Environment from "@rdfjs/environment/Environment.js";
import { BlankNode, Dataset, DatasetCore, Literal, NamedNode, Quad_Graph, Term, Variable } from "@rdfjs/types";
Expand Down Expand Up @@ -196,6 +197,18 @@ function testFactory() {

const namedNodeContext: AnyPointer<NamedNode, Dataset> = <any> {};
const deriveContextFromOtherNamedNodeContext: AnyPointer<NamedNode, Dataset> = clownface(namedNodeContext);

const factory = new Environment([
DatasetFactory,
DataFactory,
]);
const withFactory = clownface({ dataset, factory });

const incompatibleFactory = new Environment([
DataFactory,
]);
// @ts-expect-error
const withIncompatibleFactory = clownface({ dataset, factory: incompatibleFactory });
}

function testFilter() {
Expand Down
17 changes: 15 additions & 2 deletions types/clownface/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import { BlankNode, DatasetCore, DatasetCoreFactory, Literal, NamedNode, Quad_Graph, Term } from "@rdfjs/types";
import { Environment } from "@rdfjs/environment/Environment.js";
import {
BlankNode,
DataFactory,
DatasetCore,
DatasetCoreFactory,
Literal,
NamedNode,
Quad_Graph,
Term,
} from "@rdfjs/types";
import Context from "./lib/Context.js";

export type AnyContext = Term | Term[] | undefined;
Expand All @@ -20,7 +30,10 @@ interface NodeOptions {
}

export type ClownfaceInit<D extends DatasetCore = DatasetCore> = Partial<
Pick<AnyPointer<AnyContext, D>, "dataset" | "_context"> & { graph: Quad_Graph }
Pick<AnyPointer<AnyContext, D>, "dataset" | "_context"> & {
graph: Quad_Graph;
factory: Environment<DatasetCoreFactory | DataFactory>;
}
>;

type Iteratee<T extends AnyContext = undefined, D extends DatasetCore = DatasetCore> = T extends undefined ? never
Expand Down
5 changes: 3 additions & 2 deletions types/clownface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
],
"type": "module",
"dependencies": {
"@rdfjs/types": ">=1.0.0"
"@rdfjs/types": ">=1.0.0",
"@types/rdfjs__environment": "*"
},
"devDependencies": {
"@types/clownface": "workspace:.",
"@types/rdfjs__dataset": "*",
"@types/rdfjs__environment": "*"
"@types/rdfjs__data-model": "*"
},
"owners": [
{
Expand Down

0 comments on commit fba2208

Please sign in to comment.