Operating System: macOS 10.13.2
Steps to reproduce this:
git clone [email protected]:troysandal/p5js-typescript-fusebox
cd p5js-typescript-fusebox
npm i && npm run compile
I'm trying to get a basic p5Js template working with Typescript and Fusebox. In doing so I'm getting a compile errors in p5.d.ts below. You can fix the constants by inserting ///<reference path="p5.global-mode.d.ts" /> at the top of p5.d.ts. For the last error re: Noise I looked at the definition of Oscillator and Noise and found that Noise doesn't even override Oscillator::amp() so why they have different types I have no idea, but they do.
[UPDATE] - Looks like the issues is with yuidocs not giving us a return type for the overloaded method???
node_modules/p5/lib/p5.d.ts(557,19): error TS2304: Cannot find name 'COLOR_MODE'.
node_modules/p5/lib/p5.d.ts(828,87): error TS2304: Cannot find name 'ARC_MODE'.
node_modules/p5/lib/p5.d.ts(1075,21): error TS2304: Cannot find name 'ELLIPSE_MODE'.
node_modules/p5/lib/p5.d.ts(1122,18): error TS2304: Cannot find name 'RECT_MODE'.
node_modules/p5/lib/p5.d.ts(1145,18): error TS2304: Cannot find name 'STROKE_CAP'.
node_modules/p5/lib/p5.d.ts(1157,20): error TS2304: Cannot find name 'STROKE_JOIN'.
node_modules/p5/lib/p5.d.ts(1874,49): error TS2304: Cannot find name 'RENDERER'.
node_modules/p5/lib/p5.d.ts(1908,51): error TS2304: Cannot find name 'RENDERER'.
node_modules/p5/lib/p5.d.ts(1949,19): error TS2304: Cannot find name 'BLEND_MODE'.
node_modules/p5/lib/p5.d.ts(2331,21): error TS2304: Cannot find name 'BEGIN_KIND'.
node_modules/p5/lib/p5.d.ts(2412,19): error TS2304: Cannot find name 'END_MODE'.
node_modules/p5/lib/p5.d.ts(3333,19): error TS2304: Cannot find name 'IMAGE_MODE'.
node_modules/p5/lib/p5.d.ts(3407,136): error TS2304: Cannot find name 'BLEND_MODE'.
node_modules/p5/lib/p5.d.ts(3542,22): error TS2304: Cannot find name 'FILTER_TYPE'.
node_modules/p5/lib/p5.d.ts(4581,19): error TS2304: Cannot find name 'ANGLE_MODE'.
node_modules/p5/lib/p5.d.ts(4607,25): error TS2304: Cannot find name 'HORIZ_ALIGN'.
node_modules/p5/lib/p5.d.ts(4607,50): error TS2304: Cannot find name 'VERT_ALIGN'.
node_modules/p5/lib/p5.d.ts(4677,23): error TS2304: Cannot find name 'THE_STYLE'.
node_modules/p5/lib/p5.d.ts(6976,49): error TS2304: Cannot find name 'GRAPHICS_RENDERER'.
node_modules/p5/lib/p5.d.ts(7380,24): error TS2304: Cannot find name 'FILTER_TYPE'.
node_modules/p5/lib/p5.d.ts(7413,138): error TS2304: Cannot find name 'BLEND_MODE'.
node_modules/p5/lib/p5.d.ts(10265,9): error TS2415: Class 'Noise' incorrectly extends base class 'Oscillator'.
Types of property 'amp' are incompatible.
Type '(volume: number | object, rampTime?: number, timeFromNow?: number) => void' is not assignable to type '(vol: number | object,rampTime?: number, timeFromNow?: number) => AudioParam'.
Type 'void' is not assignable to type 'AudioParam'.
(this should probably be moved to the p5.sound repo)
the issue is that the Noise class overrides the Oscillator class, but it also includes doc comments for the overridden methods (even though some of these aren't even implemented in Oscillator) and it seems as though, over time, the overridden docs have gotten out-of-sync with the base class' docs.
i'm going to suggest removing the docs from the derived class for now.
@therewasaguy has merged https://github.com/processing/p5.js-sound/pull/248, so the sound noise amp definitions should be fixed in the next release. the constant definitions in non-global mode will require another fix.
@Spongman thanks for letting me know, do you need me to submit a new issue for the constant definitions?
Hello, this bug is still not resolved as of today with "p5": "^0.6.1". I am still receiving Class 'Noise' incorrectly extends base class 'Oscillator'.
Types of property 'amp' are incompatible. error.
Anyone care to fix this?
@TeemuKoivisto Hi, can you file an issue over at https://github.com/processing/p5.js-sound as the source code for p5.sound (Noise, Oscillator, etc) are all maintained there. Thanks.
@limzykenneth Hi and first thanks for the quick reply. Now that I recloned my repo it actually throws (555,19): Cannot find name 'COLOR_MODE'.. I dunno how I got that Class 'Noise'-error, I guess I did something with the typings. As a quick fix I manually remove the p5.d.ts-file. But does this error also belong to the p5.sound?
Here's the repo if you want to see it for yourself: https://github.com/TeemuKoivisto/pitch-detection.git
Most helpful comment
@therewasaguy has merged https://github.com/processing/p5.js-sound/pull/248, so the sound noise amp definitions should be fixed in the next release. the constant definitions in non-global mode will require another fix.