-
Notifications
You must be signed in to change notification settings - Fork 63
Use defineComponent
, add prop types and emit types
#1480
Conversation
Storybook and Tailwind configuration previews: Ready Storybook: https://wordpress.github.io/openverse-frontend/1480 Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again. You can check the GitHub pages deployment action list to see the current status of the deployments. |
Size Change: -409 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
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.
Is this PR meant to also have updates to tsconfig.json for these?
@@ -36,7 +36,9 @@ | |||
</template> | |||
|
|||
<script> |
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.
Should this have lang=ts on it as well?
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.
Great catch!
a4b3068
to
7b50f23
Compare
I've added the files that pass the types check. |
@@ -13,43 +16,50 @@ | |||
/> | |||
<LoadingIcon v-show="fetchState.isFetching" /> | |||
</div> | |||
<p v-show="!!fetchState.isError"> | |||
<p v-show="!!fetchState.fetchingError"> |
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.
Apparently, this was using the incorrect parameter name here, so it wasn't working correctly. Nice that TS can help us catch such problems.
# Conflicts: # src/locales/po-files/openverse.pot
"src/components/VContentLink/VContentLink.vue", | ||
"src/components/VCopyButton.vue", | ||
"src/components/VSketchFabViewer.vue", | ||
"src/components/VAudioThumbnail/**.vue", |
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.
I've ordered the list: single components outside of directories come first, then paths with **
in them, then components in sub-directories, and finally pages.
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.
Lovely!
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.
I really wish there was a better way than listing each component individually in the tsconfig.json
file. This is a good PR. I only have one minor nit and a question:
- When we remove the validator from the props, there would be no runtime warnings for invalid values because all the TS will be transpiled to JS, so shouldn't we keep them?
We have discussed with @sarayourfriend before that we want to remove the validators. I don't quite remember what the decision was regarding the runtime warnings and why we might not need them. |
Fixes
Related to Typescriptification milestone
Description
This PR is extracted from #1405 to make it easier to review.
It adds
defineComponent
, sets the language tots
, documentsemits
, and replaces JSDoc comments with TS annotations for more components. It only changes the files that can be added totsconfig
(i.e., don't have popup ariakit dependencies)Testing Instructions
Passing CI should be enough.
Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin