Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .monorepolint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const MAIN_PACKAGE = "@turf/turf";

const TAPE_PACKAGES = []; // projects that have tape tests
const TYPES_PACKAGES = []; // projects that have types tests
const TSTYCHE_PACKAGES = []; // projects that use tstyche for type tests.
const BENCH_PACKAGES = []; // projects that have benchmarks

// iterate all the packages and figure out what buckets everything falls into
Expand All @@ -39,6 +40,10 @@ glob.sync(path.join(__dirname, "packages", "turf-*")).forEach((pk) => {
if (fs.existsSync(path.join(pk, "types.ts"))) {
TYPES_PACKAGES.push(name);
}

if (fs.existsSync(path.join(pk, "test/types.tst.ts"))) {
TSTYCHE_PACKAGES.push(name);
}
});

const TS_TAPE_PACKAGES = TAPE_PACKAGES.filter(
Expand Down Expand Up @@ -216,6 +221,15 @@ export default {
includePackages: TYPES_PACKAGES,
}),

packageScript({
options: {
scripts: {
"test:types": "tstyche",
},
},
includePackages: TSTYCHE_PACKAGES,
}),

requireDependency({
options: {
devDependencies: {
Expand All @@ -242,6 +256,15 @@ export default {
includePackages: TS_PACKAGES,
}),

requireDependency({
options: {
devDependencies: {
tstyche: "^6.2.0",
},
},
includePackages: TSTYCHE_PACKAGES,
}),

requireDependency({
options: {
dependencies: {
Expand Down
3 changes: 2 additions & 1 deletion packages/turf-line-offset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"docs": "tsx ../../scripts/generate-readmes.ts",
"test": "pnpm run /test:.*/",
"test:tape": "tsx test.ts",
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
"test:types": "tstyche"
},
"devDependencies": {
"@turf/truncate": "workspace:*",
Expand All @@ -63,6 +63,7 @@
"benchmark": "^2.1.4",
"load-json-file": "^7.0.1",
"tape": "^5.9.0",
"tstyche": "^6.2.0",
"tsup": "^8.4.0",
"tsx": "^4.19.4",
"typescript": "^5.8.3",
Expand Down
37 changes: 37 additions & 0 deletions packages/turf-line-offset/test/types.tst.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { lineOffset } from "../index.js";
import { lineString, multiLineString } from "@turf/helpers";
import type { Feature, LineString, MultiLineString } from "geojson";

import { expect } from "tstyche";

const line = lineString([
[0, 0],
[10, 10],
]);
const multiLine = multiLineString([
[
[0, 0],
[10, 10],
],
[
[5, 5],
[15, 15],
],
]);

/**
* If the syntax below starts generating errors it's possible you've narrowed
* the input arguments which is likely to be a breaking change.
*/
expect(lineOffset).type.toBeCallableWith(line, 50);
expect(lineOffset).type.toBeCallableWith(line.geometry, 50);
expect(lineOffset).type.toBeCallableWith(multiLine, 50);
expect(lineOffset).type.toBeCallableWith(multiLine.geometry, 50);
expect(lineOffset).type.toBeCallableWith(line, 50, { units: "miles" });

/**
* If the sytax in this section starts generating errors, it's possible you've
* broadened the return type which is likely to be a breaking change.
*/
expect(lineOffset(line, 50)).type.toBe<Feature<LineString>>();
expect(lineOffset(multiLine, 50)).type.toBe<Feature<MultiLineString>>();
23 changes: 0 additions & 23 deletions packages/turf-line-offset/types.ts

This file was deleted.

39 changes: 28 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.