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
5 changes: 5 additions & 0 deletions types/geojson-precision/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!**/*.d.ts
!**/*.d.cts
!**/*.d.mts
!**/*.d.*.ts
14 changes: 14 additions & 0 deletions types/geojson-precision/geojson-precision-tests.ts
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions types/geojson-precision/index.d.ts
Original file line number Diff line number Diff line change
@@ -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]`.
*/
<T extends GeoJSON.Geometry>(
geometry: T,
coordinatePrecision: number,
extrasPrecision?: number,
): T;
parse: Parse;
}

declare const parse: Parse;
export = parse;
20 changes: 20 additions & 0 deletions types/geojson-precision/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
19 changes: 19 additions & 0 deletions types/geojson-precision/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
3 changes: 2 additions & 1 deletion types/markdown-it-container/index.d.ts
Original file line number Diff line number Diff line change
@@ -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;
}
}

Expand Down
3 changes: 2 additions & 1 deletion types/markdown-it-container/markdown-it-container-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();";
Expand All @@ -26,6 +26,7 @@ md.use(MarkdownItContainer, "spoiler", {
return "</div></div>\n";
}
},
marker: "marker",
});

const src = `:::spoiler This Is Spoiler Title
Expand Down
2 changes: 1 addition & 1 deletion types/markdown-it-container/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:."
Expand Down