-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing/incomplete typescript definitions #98
Comments
Thanks for reporting. The type issues will be fixed with the next version. |
FYI, I am not adding |
I've tested regl-scatterplot with the following simple Vite+TS setup and I don't see any type issues. package.json {
"name": "regl-scatterplot-ts-test",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"devDependencies": {
"typescript": "^4.9.3",
"vite": "^4.0.0"
},
"dependencies": {
"regl-scatterplot": "1.5.0"
}
} index.html <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + TS</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html> src/main.ts import { setupScatter } from './scatter';
document.querySelector<HTMLDivElement>('#app')!.innerHTML = `
<div style="position: absolute; top: 0; left: 0; right: 0; bottom: 0;">
<canvas
id="canvas"
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
/>
</div>
`
setupScatter(document.querySelector('#canvas')!); src/scatter.ts import createScatterplot from 'regl-scatterplot';
const generatePoints = (length: number) => ({
x: Array.from({ length }, () => -1 + Math.random() * 2),
y: Array.from({ length }, () => -1 + Math.random() * 2),
z: Array.from({ length }, () => Math.round(Math.random())), // category
w: Array.from({ length }, () => Math.random()), // value
});
export function setupScatter(canvas: HTMLCanvasElement) {
const scatter = createScatterplot({ canvas });
scatter.draw(generatePoints(10000));
} I am going to close this issue for now. But if you're still running into problem, please reopen the ticket and provide a reproducible example. |
I encountered the same issue as @joaorulff in #43 while integrating this with an existing Angular project. It seems the camera-2d-simple module does not have a type declaration file, which should be a relatively easy fix since you author both projects. Error:
There is also an issue that I assume to be caused by the relative path
import('./renderer')
in types.d.ts#L126. Error:Finally, I also had this issue:
Which was easily resolved with
npm install @types/d3 --save-dev
. It's not clear to me why the necessary types aren't being installed withd3-scale
itself, but perhaps adding@types/d3
to the dependencies would fix this.For all of these issues, using the
--skipLibCheck
typescript option or including the following intsconfig.json
is a workaround.The text was updated successfully, but these errors were encountered: