p5-svelte icon indicating copy to clipboard operation
p5-svelte copied to clipboard

TypeScript: p5 re-exported as a type narrows the original aliases

Open tonyketcham opened this issue 2 years ago • 0 comments

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;

tonyketcham avatar Apr 03 '22 08:04 tonyketcham