Fixed types generation

This commit is contained in:
2025-07-15 17:39:24 +02:00
parent 7fdefba622
commit c6e02087c8
4 changed files with 34 additions and 4 deletions

1
.gitignore vendored
View File

@@ -1,2 +1 @@
node_modules/
src/index.js

View File

@@ -1,7 +1,7 @@
{
"name": "@meteolab/uchart",
"publishConfig": { "access": "public" },
"version": "1.0.3",
"version": "1.0.5",
"description": "Lightweight charting library for the browser and Node.js",
"license": "MIT",
"repository": {
@@ -15,6 +15,7 @@
"module": "./dist/uchart.js",
"types": "./dist/uchart.d.ts",
"sideEffects": false,
"outDir": "./dist",
"exports": {
".": {
"types": "./dist/uchart.d.ts",
@@ -25,7 +26,7 @@
"scripts": {
"clean": "rm -rf dist",
"build:js": "esbuild src/index.ts --bundle --minify --format=esm --outfile=dist/uchart.js",
"build:types": "tsc -p tsconfig.json",
"build:types": "tsc --declaration --emitDeclarationOnly",
"build": "npm run clean && npm run build:js && npm run build:types",
"prepublishOnly": "npm run build",
"serve": "npx http-server . -c-1 --gzip"

28
src/index.d.ts vendored Normal file
View File

@@ -0,0 +1,28 @@
export type ChartSeries = {
data: [number, number][];
strokeColor?: string;
};
export declare function drawChart(ctx: CanvasRenderingContext2D, seriesList: ChartSeries[], opts: {
width: number;
height: number;
min?: number;
max?: number;
showYAxis?: boolean;
yTicks?: number;
backgroundColor?: string;
cursorX?: number | null;
}): void;
export declare function createChartElement(seriesList: ChartSeries[], opts: {
width?: number;
height?: number;
min?: number;
max?: number;
showYAxis?: boolean;
yTicks?: number;
backgroundColor?: string;
}): {
element: HTMLDivElement;
setSeries(series: ChartSeries[]): void;
setOptions(o: Partial<typeof opts>): void;
destroy(): void;
};

View File

@@ -2,11 +2,13 @@
"compilerOptions": {
"target": "ES6",
"module": "ES6",
"declaration": true,
"moduleResolution": "node",
"esModuleInterop": true,
"resolveJsonModule": true,
"strict": true,
"skipLibCheck": true
"skipLibCheck": true,
"outDir": "./dist"
},
"include": ["src"]
}