Skip to content
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

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

Open
tonyketcham opened this issue Apr 3, 2022 · 0 comments
Open
Labels
bug Something isn't working

Comments

@tonyketcham
Copy link
Owner

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 tonyketcham added the bug Something isn't working label Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant