TypeScript: p5 re-exported as a type narrows the original aliases
Opened this issue · 0 comments
tonyketcham commented
Describe the bug
When accessing nested properties on the re-exported p5
type, it throws a type error that p5
is not a namespace.
Potential fix
In types.d.ts
:
import type p5 from 'p5';
export type { default as p5} from 'p5';
/**
* A p5 instance, re-exported from `@types/p5`.
*/
/**
* A closure representing a p5 sketch in [Instance Mode](https://github.com/processing/p5.js/wiki/Global-and-instance-mode).
*
* Within the closure you can set optional `preload()`, `setup()`, and/or `draw()` properties on the given p5 instance.
*/
export type Sketch = (sketch: p5) => void;