TypeScript type naming convention - Should WP
be prefixed to types?
#48932
Replies: 5 comments
-
I've long found the I'm quite happy with removing the prefixes, so this is my vote. |
Beta Was this translation helpful? Give feedback.
-
I would also vote to drop the prefix. (Though not entirely sure I'm a voting member lol) |
Beta Was this translation helpful? Give feedback.
-
I don't see any benefit to having a WP prefix on types. I do see a drawback that the prefix adds noise making it harder to read the type name. My vote would be to remove the prefix. |
Beta Was this translation helpful? Give feedback.
-
Added a suggestion to vote in the description at the top. cc: @johnhooks and @sirreal in case you want to pile on to the voting. |
Beta Was this translation helpful? Give feedback.
-
I am working on adding types to
@wordpress/blocks
in PR #48604. A question that has come up, what is the convention regarding prefixing type names withWP
? Module scoping prevents type names from clashing, and not all packages in Gutenberg prefix types withWP
.The current JSDocs of
@wordpress/blocks
make reference to type declarations that do use the prefix and moving away from it would require updating documentation in other packages. Though since types would be new to@wordpress/blocks
, no other packages depend on theWP
prefixed names.The types exported by the DefinitelyTyped package
@types/wordpress__blocks
don't prefix the type names.How should the types be named in
@wordpress/blocks
? More generally, is there a convention for type names and is it documented some where?Vote here with a 👍 for keeping the
WP
prefix and a 👎 for getting rid of theWP
prefix.Beta Was this translation helpful? Give feedback.
All reactions