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 example as FAQ #42

Closed
wants to merge 2 commits into from
Closed

Added example as FAQ #42

wants to merge 2 commits into from

Conversation

franciscop
Copy link
Contributor

@franciscop franciscop commented Aug 8, 2024

Based on this issue, added an example of how to check the return type:

(added content follows)


Checking the type of the return value

To check the return value of a library, simply set the type to the variable in your index.d.ts:

const test: string = await myFunction();

If the function only returns a string a never a number, then this will fail:

// FAILS
const test: number = await myFunction();

README.md Outdated Show resolved Hide resolved
If the function only returns a string a never a number, then this will fail:

```ts
// FAILS
Copy link
Owner

Choose a reason for hiding this comment

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

We use different control comment for errors. And we need to add error text to it (to be sure that it is exactly the conflict with return type

@franciscop franciscop closed this by deleting the head repository Aug 13, 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.

2 participants