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

Not so much an issue but a question. #354

Open
KookiKodes opened this issue May 3, 2021 · 4 comments
Open

Not so much an issue but a question. #354

KookiKodes opened this issue May 3, 2021 · 4 comments

Comments

@KookiKodes
Copy link

KookiKodes commented May 3, 2021

How do you use typescript with these composable functions, like how should I compose the interface so that I can get proper static types. IE stamp<SomeInterface>({}) Thank you ahead of time :) ! I ask this because anytime I use Stamp.somestaticproperty. I get an error stating that the property does not exist.

@koresar
Copy link
Member

koresar commented May 4, 2021

:( I'm so sad seeing TS poor support.

There is a great effort by @PopGoesTheWza to rewrite @stamp/it using TS: stampit-org/stamp#78
Maybe he has some suggestions?

@sammys
Copy link

sammys commented May 4, 2021

@KookiKodes Besides what @PopGoesTheWza is working on, this project (stampit) does have a @types/stampit package available that will bring some useful types into play. Something like this worked for me... note that it's from memory... I didn't compile or run it:

import stampit from 'stampit';

interface IFoo {
    name: string;
}

const Foo = stampit<IFoo>({
    properties: {
        name: undefined,
    },
});

function getFoo(): stampit.Stamp<IFoo> {
    return Foo();
}

@koresar I'll take a look at stampit-org/stamp#78 to get up to speed.

@KookiKodes
Copy link
Author

I did notice the @types/stampit package and greatly appreciate the project as a whole. I will definitely try around to see if I can get the statics portion working. Thank you both for the quick replies :) ! I'll keep you updated!

@PopGoesTheWza
Copy link
Contributor

I need about a couple full days to complete the current PR for @stamp/* support... But free time is scarce at the moment.

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