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

added type declarations #37

Merged
merged 6 commits into from
Sep 20, 2023
Merged

added type declarations #37

merged 6 commits into from
Sep 20, 2023

Conversation

Ha-limLee
Copy link
Contributor

@Ha-limLee Ha-limLee commented Sep 16, 2023

Hi @j6k4m8. Appreciate your great works.

I added some type improvements here.

Thanks.

close #32

@Ha-limLee Ha-limLee marked this pull request as draft September 16, 2023 18:33
@Ha-limLee Ha-limLee marked this pull request as ready for review September 16, 2023 18:33
Comment on lines +1 to +3
{
"typescript.tsdk": "node_modules/typescript/lib"
}
Copy link
Contributor Author

@Ha-limLee Ha-limLee Sep 17, 2023

Choose a reason for hiding this comment

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

This is vscode ts version setting.

It fixes ts version to workspace's.

Since vscode comes with internal ts, different version of vscode can cause syntactic error.


declare class npyjs {

constructor(opts?: never);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made constructor receive nothing.

If user give any argument, It will throw type error.

image

};
};

export type Parsed = ValueOf<{
Copy link
Contributor Author

@Ha-limLee Ha-limLee Sep 17, 2023

Choose a reason for hiding this comment

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

This is return type of parse method.

It is tagged union type. So you can narrow the type using if or switch statements.

image

@j6k4m8
Copy link
Member

j6k4m8 commented Sep 20, 2023

This is AWESOME, thank you @Ha-limLee for this high-impact contribution — I know a lot of users will be very grateful to have these types!

@j6k4m8 j6k4m8 merged commit 56db418 into aplbrain:master Sep 20, 2023
3 checks passed
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.

TypeScript Support
2 participants