-
Notifications
You must be signed in to change notification settings - Fork 126
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
v4: RenderAs type errors for GatsbyLink (e.g. - but I suspect any customized component type would fail) #314
Labels
Comments
I suspect that what is actually wanted here is . Happy to PR this if that's the case.
|
@davepwsmith Yes please open the PR =) Thanks |
davepwsmith
added a commit
to davepwsmith/react-bulma-components
that referenced
this issue
Apr 10, 2021
davepwsmith
added a commit
to davepwsmith/react-bulma-components
that referenced
this issue
Apr 10, 2021
Uses ElementType (https://flow.org/en/docs/react/types/#toc-react-elementtype) to fix couds#314
couds
pushed a commit
that referenced
this issue
Apr 10, 2021
Uses ElementType (https://flow.org/en/docs/react/types/#toc-react-elementtype) to fix #314
couds
added a commit
that referenced
this issue
Apr 24, 2021
* Upgrade Bulma; add spacing modifiers * Remove List component * Update CHANGELOG.md * Move bulma to peerDependencies * Bump lodash from 4.17.15 to 4.17.19 Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](lodash/lodash@4.17.15...4.17.19) Signed-off-by: dependabot[bot] <support@github.com> * Remove yarn.lock * Audited packages * fix: add missing Table.Container element (#274) * fix: add missing Table.Container element * Address review feedback * fix: add missing table hoverable prop (#273) * Rewrite TypeScript Definitions (#252) * Define <Element /> and <Box /> component types * Add typedefs for more components * Add typedefs for more components * Try to add support for renderAs prop * brute forced every single html elements to apply dynamic props based on renderAs * removed some html elements because too many cases breaks ts * removed more html elements for renderAs props * removed more html elements for renderAs props * Tries to fix renderAs dynamic prop typing * Clean up the code * Add types for more components * Tidy up code * Add types for more components * Add types for the remaining components * clean up the code * remove ref attribute; fix menu type def * Add Table.Container type * Add Table hoverable prop * Remove List component * Remove sass and all dependencies #262 (#278) * remove sass and all dependencies * Fix eslint issues * update dev dependencies * update Readme * Fix prettier errors * fix button ref test * change Object.keys for Object.values * WIP: split some component typedefs into individual files. * Move index typedef to root * Move index typedef to src * Move rest of component typedefs into their own files * Trying to make tree-shaking work * Add clickable helper * Update bulma peer dep to 0.9.1 * Fix jest tests not able to run * Upgrade bulma peer dep to 0.9.2 * Refactor responsive modifier props * Change storybook import alias * Rewrite import statements in stories to use named exports * Update typedefs * Fix Jest tests * Fix decreased test coverage * Add support for flexbox helpers; add spacing helpers typedef * Add pagination first last pages (#283) * feat: add pagination first last pages originally done by @haflinger - ref: #100 * feat: add story for the showFirstLast feature in pagination * feat: add size, position and rounded props to pagination * fix: remove duplicated checking on first/last page btns * feat: update typescript def for the new pagination props * Add test case for showFirstLast prop Co-authored-by: Kenneth Ng <ngcreeper@outlook.com> * Add missing TypeScript exports * Add documentation (#251) * init documentation * fix dependencies * import only used components * Improve docs distribution create folder/files structure * Add npm script for starting docs website * Add columns basic documentation * documentation (#266) * documentation * Update card.md * Update tiles.md * Update box.md * Update card.md * Update content.md * Update media.md * new * Update gap.md * Update nesting.md * Update options.md * Update responsiveness.md * Update card.md * Update dropdown.md * Update menu.md * Update message.md * Update navbar.md * Update pagination.md * Update panel.md * Update tabs.md * Update box.md * Update button.md * Update icon.md * Update notification.md * Update progress-bar.md * Update tag.md * Update container.md * Update level.md * new * new * new * Tidy up code * Update column size documentation * Fix small typo in column size doc * Update column responsiveness doc * Update column nesting doc * Accidentally removed Section import in column nesting doc * Add missing code example in column responsiveness doc * Update column gap doc * Update column options doc * Update column basics doc * Update container doc * Update level doc Co-authored-by: Kenneth <kenneth.ng.5226@outlook.com> * Update bulma to 3.4.0 * Add pagination first last pages (documentation) (#284) * docs: add doc for pagination first/last btns, size, position and rounded * chore: code consistency Co-authored-by: John Benavides <john.elric@gmail.com> Co-authored-by: Quadri Sheriff <59125401+Quadrisheriff@users.noreply.github.com> Co-authored-by: Yuen Ying Kit <yingkityuen@gmail.com> * Documentation: Use `next` branch of library * Update pagination documentation * Update import statements in docs * Fix incorrect type path * Fix incorrect type path * Update README.md * Move old logo to documentations folder * Fix incorrect bulma version * Fix missing array type for Select * Remove Button state prop * Fix Warning: Failed prop type: Invalid prop value supplied to Select (#288) * Fix Warning: Failed prop type: Invalid prop value supplied to Select * Fix stylistic issues - Format code with Prettier - Use double quote for JSX strings - Introduce local defaultValue function * Remove tests that check no error is thrown * Fix defaultValue function * Group Select value PropTypes tests * Move value PropTypes tests in Select component group * Use dot notation * Change input-file to a controled component * 4.0.0-0 * update typescript definitions for input-file * Implement state props for Form.Input * Remove loading prop from Form.Input * Add rounded prop to Form.Input * Migrate to storybook addon-docs from docusaurus (#289) * Add addon-essentials storybook plugin * Rewrite <Box /> doc * WIP: implement breadcrumb doc * WIP: Implement Breadcrumb doc * Implement Breadcrumb doc * Update box doc * Add button doc * Implement Card doc * Add theme to storybook * WIP: Add column doc * Add Columns doc * Add Columns doc * Add Container doc * Add Content doc * WIP: add dropdown doc * Add Dropdown doc * Add Footer doc * Implement Form doc * WIP: add Form.Input doc * Implement Form.Input doc * Document rounded prop of Form.Input * Allow override of renderAs of Form.Input; remove default HTML attrs propTypes * Add is-flex helper support * Also support other display classes via display modifier prop * Forgot to apply display prop to class names; fix test * Support text size 7 * Add support for font family modifiers * Add is-sr-only modifier support * Add doc landing page; Add renderAs and modifier doc * Add checkbox doc * Remove some deprecated packages; audited packages * Revert storybook upgrade * WIP: Textarea doc * Add some missing Form.Textarea props * Add Textarea doc; remove Element story code * Remove loading prop from Form.Textarea and Form.Input * Add rounded props for Form.Select * WIP: add Select doc * Finish Select doc * Add various state props for Select * Add Radio doc * Fix failing InputFile test * Rename InputFile value prop to files; update InputFile type * Add Menu doc * Add message doc * Fix missing Modal ts props * Fixes issues with modal children (#302) (#303) * Revert "Fix missing Modal ts props" This reverts commit f2e1a0a. * Update modal types to include document, children, classname * Add string column widths to types (#304) * 4.0.0-1 * Add Breadcrumb.Item component to replace Breadcrumb items prop (#293) * WIP: Add Breadcrumb.Item component * Add test and types for Breadcrumb.Item * Add centered prop to InputFile * Add InputFile doc * Add InputFile prop table * Add InputFile label control * Heading will now render appropriate header element based on supplied size. * Revert prev commit * Add Heading doc * Add missing m/p spacing helpers * Use default export on component level ts definition (#308) * add icon to dropdown props definition (#310) Co-authored-by: Matt McCorry <matt@auktechnologies.com> * 4.0.0-2 * Update docs and improve/normalize components props (#309) * Update columns docs * add Block component * fix tests * more docs * add more components to the docs * added all elements * Add missing links to bulma.io documentation * [WIP] use Element.proptypes and defaultProps instead of modifier * update can i use * use Element proptypes ans defaultprops * breadcrumb component * add card * refactor dropdow to stop using class component * dropdown docs * Menu component * Enable classProperties in babel * Fix storybook webpack issue * Add level doc * Message docs * Fix render as a color constants * add bulma docs link to message story * update modal component * update snapshots * remove modifier dependency * remove modifiers folder * if button type its reset or submit force renderAs button * remove modifiers import from d.ts files * finish Element docs (for now) * normalize normalize position (center -> centered) * docs improvements * delete documentation folder * more default props * fixes * update reponsive text alignment * Rename textAlignment to textAlign * even more... * refactor pagination to functional component * remove babel plugin not need it anymore * update dependencies * add pagination docs * Panel docs * tabs docs * dome Form component docs * Fix input tests * Texta area and tests * Select docs * Checkbox * Radio docs * Add label story * Passdown size prop from Field to childrens * update test and lower coverage (for now) * Finish form docs * remove unused files * - Container Docs - Remove Fluid from container - Add fluid as a possible value of breakpoint - Add Max prop to container * Level docs * rename position to align * update Changelog * remove Media.Content component (duplicates Content Component) * Hero * Add Section docs * Update Footer docs * add Tile docs * remove notification and color props from Tile * improve Tile docs * Improve responsive gap prop * remove unused mock Co-authored-by: Kenneth <kenneth.ng.5226@outlook.com> * 4.0.0-RC.0 * - Normalize align on Navbar.Container - Add size to Navbar (is-spaced) - Normalize non-responsive display prop - Add invisible prop to all components - Ignore size on Hero if hasNavbar is true * small fixes * 4.0.0-RC.1 * add relative to display prop allowed values * add text prop to icon component * Fix build and tests * improve order of common proptypes * Fix #313 add size as optional prop * Fix issue with RenderAsComponent type (#316) Uses ElementType (https://flow.org/en/docs/react/types/#toc-react-elementtype) to fix #314 * Allow Color and size custom props Add Color custom&extend docs * - Fix tests - Remove proptypes from bundle * normalize Statues * Improve Changelog * 4.0.0-RC.2 * Test package configurations * Add hero halfheight size * Fix test runner * Allow pass IconType to control to use on isIcon function * 4.0.0-RC.3 * update bulma peer dependency * fix package json files field * 4.0.0-RC.4 * include ts definitions on package * 4.0.0-RC.5 * add shades as valid buttons colors * fix imports on TS (Gatsby) * 4.0.0-RC.6 * add cjs and esm builds * 4.0.0-RC.7 * Fix Menu.Item.List children proptype * More improvements * 4.0.0-RC.8 * build library as a prepublish step * add renderAs to TagGroup * fix prepublish script * update travis to node 14 * regenerate package-lock * Try to fix CI Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: John <john.elric@gmail.com> Co-authored-by: Yuen Ying Kit <yingkityuen@gmail.com> Co-authored-by: Quadri Sheriff <59125401+Quadrisheriff@users.noreply.github.com> Co-authored-by: 1r3n33 <59848434+1r3n33@users.noreply.github.com> Co-authored-by: John Benavides <john.benavides@gartner.com> Co-authored-by: David Smith <davepwsmith@users.noreply.github.com> Co-authored-by: Matt McCorry <mccorry@gmail.com> Co-authored-by: Matt McCorry <matt@auktechnologies.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Having the type as seems to have a dual effect of expecting multiple children, and also preventing other typed components being used for renderAs.
Changing
export type RenderAsComponent = string | React.ComponentType<never>
to
export type RenderAsComponent = string | React.ComponentType
or
export type RenderAsComponent = string | React.ComponentType<any>
Both seem to fix the problem, but not sure what the side effects would be.
Are you looking to explicitly prevent people from using other components in renderAs? Because that will basically prevent people from using this with Gatsby I think?
The text was updated successfully, but these errors were encountered: