Skip to content

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

@tonyketcham

Description

@tonyketcham

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions