Type Declarations

Where’s a good place to get the micro:bit specific type declarations? I’ve built some pxt extensions for some yahboom peripherals, but it’s kind of annoying for pins, DigitalPin, PulseValue, control, etc. to be undefined. It’d be great to get auto-completion. It’d also be cool if I could get a neopixel type declaration too.

Thanks!!!

Are you talking about testing them out? I think you can use arcade.makecode.com/playground or something. I tried it out and it doesn’t work. I forgot what the link is but I hope it helps. @jwunderl, you know where it is right?

That site is https://makecode.com/playground (no arcade in front of it) :slight_smile:

In this case, though, we’d probably want something else - that site is good for building blocks, but it doesn’t have the same autocomplete / etc to get everything working as expected.

In this case, are you planning on making extensions in typescript, or will they require cpp as well? If its just ts (or mostly ts), I would suggest trying out the github integration: https://makecode.com/extensions/github-authoring . Otherwise, I’d have to check if we have anything better - I don’t change the c++ that often, so when I do I’ve just worked with it having a few types mistaken. If I remember right the cli steps here might help a bit: https://makecode.com/extensions/getting-started/vscode

OOOOOOOOOH… No arcade in it. Got it. Ie been looking for the makecode playground so I can actually test some of my ideas out

Thanks for getting back to me (you too @Dreadmask197).

Playground is going to be super handy. It’s funny, I ran across it but never connected that I could be doing the designing in playground. Probably because I spend so much time in vscode that it didn’t feel like a web-editor would suffice. :man_facepalming:

I did try the getting-started guide with vscode but ran into a snag with pxt (Getting started with a pxt extension for micro:bit). I was digging through the dependencies looking for which one had a typo in the package.json but decided I could just as easily manually define the pxt config files (which I did and moved on).

But, it was frustrating not having the types in vscode which would probably be addressed if pxt would’ve worked. I’ll bet I just need to reference https://www.npmjs.com/package/pxt-microbit and I may just need to point to some of the definition files in my tsconfig. I’ll go give that a shot and then report back here . . . for posterity. :slight_smile:

OK. It looks like this is a non-trivial effort. These projects don’t seem to emit type declarations. :frowning:

I’ll try to come up with something later. I may just clone the repos, emit the type declarations, and add them to definitely typed or something.

For in /localtypings for .d.ts files for pxt, in particular pxtpackage.d.ts