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

Typescript support #13

Closed
william0bra opened this issue Aug 10, 2022 · 10 comments
Closed

Typescript support #13

william0bra opened this issue Aug 10, 2022 · 10 comments
Assignees

Comments

@william0bra
Copy link

Typescript would be great here.

@karmaniverous
Copy link
Owner

Not a TS guy. Can you explain the issue a little more deeply?

@welkinwong
Copy link

same, need ts

@karmaniverous
Copy link
Owner

Ok guys I hear the request. Not a TS guy myself and don't have any need of it for my own projects, but I'm happy to roll a revision in if you care to make it.

That said: why is it so important? The code works and the JSDoc provides intellisense support. Shouldn't TS just bundle this package as-is? Makes me wonder if there's an issue with the package config.

@welkinwong
Copy link

welkinwong commented Feb 17, 2023

Ok guys I hear the request. Not a TS guy myself and don't have any need of it for my own projects, but I'm happy to roll a revision in if you care to make it.

That said: why is it so important? The code works and the JSDoc provides intellisense support. Shouldn't TS just bundle this package as-is? Makes me wonder if there's an issue with the package config.

in ourselves project, this will be throw an error message and highline code

@karmaniverous
Copy link
Owner

karmaniverous commented Feb 20, 2023

Hm ok I think I caught the gist of that.

Making this thing work with TS is probably more than I am equipped to take on. That will require the assistance of somebody who is familiar with TS, although I would LOVE to learn what I'm doing that is breaking TS!

A suggestion: the project isn't really super complicated. You could probably fork it and in an afternoon either...

  1. refactor it into TS or
  2. get the packaging working for TS.

If you do number 2 I would be delighted to review & incorporate your changes.

@karmaniverous
Copy link
Owner

P.S. Another thought... have you updated to the latest release? I populated the deprecated main key in package.json to support VS Code IntelliSense and who knows but that might have been breaking TS as well.

@karmaniverous karmaniverous pinned this issue Feb 20, 2023
@drabelogarner
Copy link

drabelogarner commented Aug 18, 2023

To get this halfway there, you can add the types manually.

Create a global.d.ts file and add this

declare module '@karmaniverous/serify-deserify' {
  let createReduxMiddleware: () => any;
  let deserify: <T>(obj: any) => T;
  let serify: <T>(obj: any) => T;
}

Then pass in a type when calling deserify.

const date = deserify< Date >(selectDate);

@karmaniverous
Copy link
Owner

@drabelogarner that's a great idea thank you!! Standing by for your PR. 😁

@karmaniverous karmaniverous self-assigned this Apr 21, 2024
@karmaniverous
Copy link
Owner

For those of you who are still paying attention: I guess now I'm a TypeScript guy. 🤣 Should have a TS release of this in a few days!

karmaniverous added a commit that referenced this issue Apr 24, 2024
karmaniverous added a commit that referenced this issue Apr 24, 2024
karmaniverous added a commit that referenced this issue Apr 25, 2024
karmaniverous added a commit that referenced this issue Apr 25, 2024
karmaniverous added a commit that referenced this issue Apr 25, 2024
…factor

Feature/gh 13 typescript refactor
@karmaniverous
Copy link
Owner

This is done! serify-deserify is now fully type safe. See the README for more info and please don't hesitate to ping me with any questions!

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

No branches or pull requests

4 participants