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

add TypeScript boilerplate #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

yuichkun
Copy link
Contributor

Now that node.script accepts command line parameters, I've come to my mind that I could pass in ts-node/register to use TypeScript with minimal effort and here's a working example!

By the way, do you guys have the definition file (@types/max-api.d.ts kind of thing) of Max API published somewhere? If not, I would really appreciate it if you do!

@geofholbrook
Copy link

geofholbrook commented Feb 21, 2023

Don't know if the OP is still keen on this 3 years later ... but I've gotten @types/max-api published now, through the DefinitelyTyped project. Quite similar to the declaration file that's in your boilerplate: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/max-api.

@fde31
Copy link
Member

fde31 commented Apr 4, 2023

There is a pending PR to update the type definitions to the recent version, which also fixes some of the parameter signature issues and exports maxAPI as the default namespace. Once that is merged and published, maybe you'd like to update your boilerplate @yuichkun and I'd be happy to merge the PR.

@yuichkun
Copy link
Contributor Author

yuichkun commented Apr 5, 2023

Hi @geofholbrook @fde31

Thank you guys for publishing/updating the type definitions.
I'd love to update my boilerplate once the pending PR is merged, and also since the boilerplate was created a good few years ago, so I'll take this chance to update it with more modern config/dependencies, too 👍

By the way, can I have the URL for the pending PR, @fde31 ?

@fde31
Copy link
Member

fde31 commented Apr 5, 2023

@yuichkun @types/max-api v2.0.0 are now published on NPM (via this PR on DefinitelyTyped).

There is a very basic TS example in n4m-examples but if u have the motivation and time to update your boilerplate I'm that would be appreciated by others and provide a great help for people to get started as well.

@geofholbrook
Copy link

@fde31 I noticed something about @types/[email protected] after I approved it ... it is not possible to import selected parts of the namespace, as in import { addHandler, outlet, post } from 'max-api'; ... my workaround is import maxAPI from 'max-api'; const { addHandler, outlet, post } = maxAPI;, but it seems kind of too bad that the definitions would disallow something that works fine in runtime.

@geofholbrook
Copy link

Just a thought: I've been think that a npx tool to setup new n4m projects would be nice, kind of in the same vein as create-react-app ... might help more people get into it. And similarly we could have an option to set up all the typescript parts, like create-n4m-app --template typescript.

May or may not related to the PR, but it could be hosted in this repo at least.

@fibonacid
Copy link

I have created a PR request for this:
#10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants