rstacruz/remount

Typescript migrate?

Opened this issue · 5 comments

Hello.

Just found this library from https://stackoverflow.com/a/73214171 and so far looks very promising.

I wanted to ask, are there any plans to migrate it to Typescript, if yes then I can try to contribute on this part.

Regards.

Thanks for checking in! Remount should already have TypeScript types available. They're written using TypeScript's Jsdoc syntax.

Thanks for checking in! Remount should already have TypeScript types available. They're written using TypeScript's Jsdoc syntax.

That has nothing to do with Typescript. These are documentation while Typescript allows us to transpile the code to more targets.

Using this library from React with Typescript requires us to manually declare modules using ``.d.tsas well there are no types on@types/remount` ?

I think you misunderstood what I meant, therefore It makes sense to open the issue again and let someone contribute on this issue.

Using this library from React with Typescript requires us to manually declare modules using .d.ts as well there are no types on@types/remount` ?

Interesting - thanks for this report! This was not the intention at all - there are .d.ts files shipped with the npm distribution (https://cdn.jsdelivr.net/npm/remount@1.0.0/dist/), but it looks like something may be amiss if .d.ts are manually required. The idea was to write Remount in .js files, document it with jsdoc, then use TypeScript to generate .d.ts files from the jsdoc documentation comments.

These are documentation

...apart from being documentation, it's also there for type checking (yarn tsc will run TypeScript type checks with these jsdoc types), and also for generating TypeScript type files.

Granted I haven't had a chance to test this out myself so something might be amiss. Keen to hear any ideas!

@rstacruz Shipping the .d.ts files is the right idea, but I think it also needs a reference in package.json like "types": "./dist/index.d.ts"

Pull request #92 fixes this.