From e17598963a0c328ccbe4aa7e7cdc9edddd56f6e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=E2=84=93e=20Hensel?= Date: Sat, 13 Dec 2025 12:04:49 +1100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74168=20[geojs?= =?UTF-8?q?on-precision]=20create=20definitions=20by=20@k-yle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/geojson-precision/.npmignore | 5 ++++ .../geojson-precision-tests.ts | 14 ++++++++++ types/geojson-precision/index.d.ts | 26 +++++++++++++++++++ types/geojson-precision/package.json | 20 ++++++++++++++ types/geojson-precision/tsconfig.json | 19 ++++++++++++++ 5 files changed, 84 insertions(+) create mode 100644 types/geojson-precision/.npmignore create mode 100644 types/geojson-precision/geojson-precision-tests.ts create mode 100644 types/geojson-precision/index.d.ts create mode 100644 types/geojson-precision/package.json create mode 100644 types/geojson-precision/tsconfig.json diff --git a/types/geojson-precision/.npmignore b/types/geojson-precision/.npmignore new file mode 100644 index 00000000000000..93e307400a5456 --- /dev/null +++ b/types/geojson-precision/.npmignore @@ -0,0 +1,5 @@ +* +!**/*.d.ts +!**/*.d.cts +!**/*.d.mts +!**/*.d.*.ts diff --git a/types/geojson-precision/geojson-precision-tests.ts b/types/geojson-precision/geojson-precision-tests.ts new file mode 100644 index 00000000000000..1da19490af5e90 --- /dev/null +++ b/types/geojson-precision/geojson-precision-tests.ts @@ -0,0 +1,14 @@ +import type { LineString, Point } from "geojson"; +import parse from "geojson-precision"; + +const point: Point = { type: "Point", coordinates: [12.45, 56.78] }; +let line: LineString = { type: "LineString", coordinates: [] }; + +let trimmed = parse(point, 3); +// $ExpectType Point +trimmed; + +line = parse(line, 4); +line = parse.parse(line, 4); + +parse.parse.parse.parse.parse; // this is silly, but technically possible diff --git a/types/geojson-precision/index.d.ts b/types/geojson-precision/index.d.ts new file mode 100644 index 00000000000000..10c767f876eac1 --- /dev/null +++ b/types/geojson-precision/index.d.ts @@ -0,0 +1,26 @@ +import * as GeoJSON from "geojson"; + +interface Parse { + /** + * Remove meaningless precision from your GeoJSON. + * + * @param coordinatePrecision A positive integer. If your specified precision value + * is greater than the precision of the input geometry, the output precision + * will be the same as the input. For example, if your input coordinates are + * `[10.0, 20.0]`, and you specify a precision of `5`, the output will be the + * same as the input. + * + * @param extrasPrecision A positive integer specifying extra coordinate precision + * for things like the `z` value when the coordinate is + * `[longitude, latitude, elevation]`. + */ + ( + geometry: T, + coordinatePrecision: number, + extrasPrecision?: number, + ): T; + parse: Parse; +} + +declare const parse: Parse; +export = parse; diff --git a/types/geojson-precision/package.json b/types/geojson-precision/package.json new file mode 100644 index 00000000000000..5bda3ae879e611 --- /dev/null +++ b/types/geojson-precision/package.json @@ -0,0 +1,20 @@ +{ + "private": true, + "name": "@types/geojson-precision", + "version": "1.0.9999", + "projects": [ + "https://github.com/jczaplew/geojson-precision" + ], + "dependencies": { + "@types/geojson": "*" + }, + "devDependencies": { + "@types/geojson-precision": "workspace:." + }, + "owners": [ + { + "name": "Kyle Hensel", + "githubUsername": "k-yle" + } + ] +} diff --git a/types/geojson-precision/tsconfig.json b/types/geojson-precision/tsconfig.json new file mode 100644 index 00000000000000..b514d4d6140cb4 --- /dev/null +++ b/types/geojson-precision/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "node16", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "geojson-precision-tests.ts" + ] +} From 6e04b75ae5bae63a422069fee7538cbca10a4102 Mon Sep 17 00:00:00 2001 From: Jimmy Leung <43258070+hkleungai@users.noreply.github.com> Date: Sat, 13 Dec 2025 12:35:01 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74100=20fix(ma?= =?UTF-8?q?rkdown-it-container):=20import=20from=20`markdown-it/lib/render?= =?UTF-8?q?er`=20by=20@hkleungai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/markdown-it-container/index.d.ts | 3 ++- types/markdown-it-container/markdown-it-container-tests.ts | 3 ++- types/markdown-it-container/package.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/types/markdown-it-container/index.d.ts b/types/markdown-it-container/index.d.ts index 540a3baf9adbc6..87aafd33c0def0 100644 --- a/types/markdown-it-container/index.d.ts +++ b/types/markdown-it-container/index.d.ts @@ -1,10 +1,11 @@ import MarkdownIt = require("markdown-it"); +import Renderer = require("markdown-it/lib/renderer"); declare namespace MarkdownItContainer { interface ContainerOpts { marker?: string | undefined; validate?(params: string): boolean; - render?: MarkdownIt.Renderer.RenderRule | undefined; + render?: Renderer.RenderRule | undefined; } } diff --git a/types/markdown-it-container/markdown-it-container-tests.ts b/types/markdown-it-container/markdown-it-container-tests.ts index 42e1220908b72e..7b9e1276d3a0de 100644 --- a/types/markdown-it-container/markdown-it-container-tests.ts +++ b/types/markdown-it-container/markdown-it-container-tests.ts @@ -5,7 +5,7 @@ import MarkdownItContainer = require("markdown-it-container"); const md = new MarkdownIt(); md.use(MarkdownItContainer, "spoiler", { - validate: (params: any) => params.trim().match(/^spoiler\s+(.*)$/), + validate: (params: string) => params.trim().match(/^spoiler\s+(.*)$/), render: (tokens: MarkdownIt.Token[], index: number) => { const match = tokens[index].info.trim().match(/^spoiler\s+(.*)$/); const onClick = "this.parentNode.classList.toggle('_expanded');" + "event.preventDefault();"; @@ -26,6 +26,7 @@ md.use(MarkdownItContainer, "spoiler", { return "\n"; } }, + marker: "marker", }); const src = `:::spoiler This Is Spoiler Title diff --git a/types/markdown-it-container/package.json b/types/markdown-it-container/package.json index a1b6f8d6673ef6..dc089f647432bc 100644 --- a/types/markdown-it-container/package.json +++ b/types/markdown-it-container/package.json @@ -6,7 +6,7 @@ "https://github.com/markdown-it/markdown-it-container" ], "dependencies": { - "@types/markdown-it": "*" + "@types/markdown-it": "<14" }, "devDependencies": { "@types/markdown-it-container": "workspace:."