Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Product Collection: Implement Preview Mode #46369
Product Collection: Implement Preview Mode #46369
Changes from 51 commits
681110f
d139b22
b61b00f
39e0128
95fbfe7
109c961
9a3ed04
0055a48
7950dfd
b268b79
ce7b35f
2370b1e
29b1e15
3a66aa2
10c1a75
76c4284
0caf11d
aee02e4
c8d5ef8
9992019
f17a694
1ccac85
4aa2432
423d710
d18b015
b463b3b
30bede2
6d6eae2
7ec76f2
d4d0e08
95f5778
0e702aa
b84c73b
5741fd9
76b310f
01b36f2
5cfb2ac
7802a6d
36de12b
adacede
4de5a96
ab29e68
4bcec0b
f8ccbcc
8c9b9d7
790f664
856f791
6c6181f
d530f00
6b8ad73
13af5b3
f93ebcd
b08a481
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 BlockEdit supposed to be the edit component? ElementType would be too broad for that.
It would be more something like ComponentType.
The last defined types in Gberg def typed definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/wordpress__blocks/index.d.ts#L180
(afaict latest blocks doesnt ship with types yet? shrug)
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 spent some time trying to use
ComponentType<BlockEditProps<T>> | undefined
but it is resulting into more TS errors. I am getting following error, do you have any idea why I am getting this error? 🤔If it helps, I tried to use
ComponentType
from `'@wordpress/element' as we aren't supposed to import directly from "react", right?Do you mean, woo blocks doesn't ship with types? 🤷🏻♂️
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.
as i mentioned in another comment, you absolutely can import types from react. types are erased at compilation. For some reason wp element is erasing the generics of the ComponentType so the fix here would indeed be to import from react (I tested and it works 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.
I am getting following error when I try importing from
react
:I can ignore this lint error by adding following line:
What do you think? Is it worth it to import "ComponentType" from "react" and then disable eslint for import statement?