Gaweph / p5-typescript-starter

Base starter project using p5js and typescript
MIT License
344 stars 173 forks source link

Missing properties of p5.color #2

Closed mamazu closed 5 years ago

mamazu commented 5 years ago

It is missing some properties of p5.Color like levels or maxes

Gaweph commented 5 years ago

I have updated the repository to have the latest version of the p5 types.

You can pull the latest

Or

You can do this yourself with:

npm install --save-dev @types/p5

You will also need to add a typing file to expose the types to the global namespace:

import module = require('p5');
export = module;
export as namespace p5;
declare global {
    interface Window {
        p5: typeof module;
    }
}

I hope this helps. Let em know if there are still things missing.

mamazu commented 5 years ago

I just cloned a new copy of the project and after a long typescript build time it throws this error: node_modules/@types/p5/src/webgl/material.d.ts(62,11): error TS2304: Cannot find name 'MediaElement'.

Gaweph commented 5 years ago

@mamazu Looks like this is a known issue with the current type definition file:

https://github.com/p5-types/p5.ts/issues/9

You should be able to ignore this for now as it's not an error with your code. I will update to a newer version of the p5 type definition when one becomes available.

mamazu commented 5 years ago

Thanks.