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

feat: improve type definition for AbitbolClass #44

Merged
merged 3 commits into from
Jun 3, 2024

Conversation

Pduhard
Copy link
Contributor

@Pduhard Pduhard commented May 28, 2024

Improve type definition for AbitbolClass

To works properly you now need to export AbitbolClass with named export + type definition

in ts:

const MyClass = Class.$extend({ ... });

export { MyClass };

export type MyClass = InstanceType<typeof MyClass>;

in js with jsdoc :

const MyClass = Class.$extend({ ... });

export { MyClass };

/**
 * @typedef {InstanceType<typeof MyClass>} MyClass
 */

One remaining issue is this case not working due to circular reference :/

const Cls1 = Class.$extend({
    meth1() {
        return new Cls2();
    },
}); // ==> any

const Cls2 = Cls1.$extend();
const c1 = new Cls1();
c1.meth1();

Copy link
Contributor

@jbghoul-wanadev jbghoul-wanadev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good To Me

& SP
& (new (...args: InitArgType<E, I>) => PI)

export class AbitbolClass {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be complete, there are missings static $class and static $map

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flozz flozz merged commit b54a107 into wanadev:master Jun 3, 2024
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.

3 participants