-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Improve documentation #55
Comments
A few ideas off the top of my head:
Hope that helps! 🙂 |
Hi everyone, I am trying to learn how to use this tool, but to be honest I find the documentation very lacking. I see that Sindre uses this in basically all his projects and it seems great, but really I can't figure out how Let me begin by quoting readme:
There must be some mistake here in the readme, right? This explanation does not even seem to be connected with the name
Although this is definitely less cryptic than the explanation for Long story short, I had to install |
I will include here a summarized version of my thought process and experimentation process, hoping it will help clarify in which sense I think the docs are lacking. My setup:
|
So far I have no idea what is this |
Also, my editor shows a red squiggle below all Update: adding |
expectError<boolean>(someIdentifierNotEvenDeclared);
🤔 I have no idea what is happening here. It found an error but didn't.
expectError({{}});
Maybe |
Oh! The following does not pass: const res = concat(5, 's');
expectError(res);
So it looks like |
Sorry for flooding the thread. Let me know if I should delete the above comments. Request summary
|
Adding up to @treybrisbane's #55 (comment) with regards to test file placement: I've just started using
As you can see, I can't just plonk an Being the novice that I am, I imagined I'd find the clues in the README file. I couldn't find it. Thankfully, I found myself a reference from @sindresorhus's works. Otherwise, I'd still be stuck. To support my working structure, I must use this setup: package.json {
"name": "my-would-be-typed-libary",
"types": "types/index.d.ts",
"tsd": {
"directory": "types/components/__tests__"
},
...
} |
@SamVerschueren If you could please provide answers to my questions here, I will be happy to send a PR clarifying everything. Thank you! |
@papb I probably can answer some of your questions. Some things that you've found are bugs, some are intended behavior. First of all,
You have multiple things going on here, you've triggered the bugs fixed in #103 and #104.
The way So it's up to you to make sure that you don't have any other type errors in your expression for expectError(concat(5, 's')); // passes (after #104), expression contains a type error (no overload signature found...)
expectError<string>(concat(5, 5)); // fails, no error, result of `concat` is assignable to `string`
expectError<void>(concat(5, 5)); // passes, result of `concat` is not assignable to `void`
expectError<number>(concat(5, 5)); // passes, result of `concat` is not assignable to `number`
expectError<any>(concat(5, 5)); // fails, everything is assignable to `any`
expectError<Error>(concat(5, 5)); // passes, result of `concat` is not assignable to `Error`
expectError<typeof expectError[]>(concat(5, 5)); // passes, result of `concat` is not assignable to `typeof expectError[]`
expectError<unknown>(concat(5, 5)); // fails, everything is assignable to `unknown`
expectError<never>(concat(5, 5)); // passes, result of `concat` is not assignable to `never`
Yes, exactly, We extend Hope this helps and clarifies a few things. |
As an aside, you're very welcome to make PRs for documentation improvements. |
I think we need to improve the documentation a bit. But I'm not sure how to provide the right amount of information.
So any ideas here are more than welcome. Like, should we add more examples? Should we add an example per assertion to make it more clear? Is the description good enough?
The text was updated successfully, but these errors were encountered: