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
[Contributor Doc] Type System CheatSheet #20168
Conversation
…to v5/tsdoc/init-doc-main-types
…epts # Conflicts: # docs/docs/guides/05-type-system/01-philosophy.md # packages/core/types/src/schema/attribute/definitions/uid.ts # packages/core/types/src/schema/index.ts # packages/core/types/src/struct/schema.ts # packages/core/types/src/uid/index.ts
Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
…gistry.mdx Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
…gistry.mdx Co-authored-by: Hannah Paine <151527179+hanpaine@users.noreply.github.com>
…gistry.mdx Co-authored-by: Hannah Paine <151527179+hanpaine@users.noreply.github.com>
…gistry.mdx Co-authored-by: Hannah Paine <151527179+hanpaine@users.noreply.github.com>
…gistry.mdx Co-authored-by: Hannah Paine <151527179+hanpaine@users.noreply.github.com>
…gistry.mdx Co-authored-by: Hannah Paine <151527179+hanpaine@users.noreply.github.com>
Co-authored-by: Hannah Paine <151527179+hanpaine@users.noreply.github.com>
Co-authored-by: Hannah Paine <151527179+hanpaine@users.noreply.github.com>
Co-authored-by: Hannah Paine <151527179+hanpaine@users.noreply.github.com>
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start, this will be helpful!
Can you make sure to run yarn prettier:write
on this?
Or I'd be super happy if you could find out why your editor doesn't automatically do it on save, because this has been happening to a lot of people (myself included) seemingly randomly ever since I upgraded to prettier v3. There's definitely something odd going on but I haven't been able to figure it out.
```typescript | ||
import type { Data } from '@strapi/types'; | ||
|
||
function find(): Data.Entity {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give a code example with a return to see when this might be used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand completely what you're referring too? Do you want an actual body definition for the function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, like a use case showing what you would select in order to want to return a generic Data.Entity. Not important though, just a thought.
Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
Prettier is still failing, do we need the fix you did on v5/main? And furthermore, is there something broken with |
We need to understand how to make prettier really understand mdx (because that's not the case currently) For now everything works well with the exception of 1 prettier-ignore block comment. We can add a note/task to look at this later |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
```typescript | ||
import type { Data } from '@strapi/types'; | ||
|
||
function find(): Data.Entity {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, like a use case showing what you would select in order to want to return a generic Data.Entity. Not important though, just a thought.
I saw Piwi mention that prettier isn't great for documentation as it will often flag a deliberate formatting 'error' that we want there - same situ? |
Here it's a bit more complicated, but the gist of it is that we've never spent time really configuring it for our docs. So sometimes it gets in the way a bit. We'll hopefully get a chance to improve that soon. |
What does it do?
Init a cheatsheet for the type system in the contributor documentation
Note: This is honestly just a start. If you've any idea of what could/should/must be added, don't hesitate to comment
How to test it?