|
1 | 1 | # Release Notes
|
2 | 2 |
|
| 3 | +## 7.0.0 |
| 4 | + |
| 5 | +### Major Changes |
| 6 | + |
| 7 | +- [#846](https://github.com/reactjs/react-docgen/pull/846) |
| 8 | + [`82154c3`](https://github.com/reactjs/react-docgen/commit/82154c3b59bf22acf3068165f87b089138fdf7ae) |
| 9 | + Thanks [@danez](https://github.com/danez)! - `getTypeFromReactComponent` now |
| 10 | + returns an array of paths to types instead of just one. This can appear when |
| 11 | + multiple type definitions are found for a component, for example: |
| 12 | + |
| 13 | + ```ts |
| 14 | + const Component: React.FC<Props> = (props: { some: string }) => {}; |
| 15 | + ``` |
| 16 | + |
| 17 | + In this example both the `Props` definition as well as `{ some: string }` are |
| 18 | + now found and used. |
| 19 | + |
| 20 | + Here is a simple diff to illustrate the change when using |
| 21 | + `getTypeFromReactComponent`: |
| 22 | + |
| 23 | + ```diff |
| 24 | + |
| 25 | + const type = getTypeFromReactComponent(path) |
| 26 | + |
| 27 | + -if (type) { |
| 28 | + +if (type.length > 0) { |
| 29 | + // do smth |
| 30 | + } |
| 31 | + |
| 32 | + ``` |
| 33 | + |
| 34 | +- [#848](https://github.com/reactjs/react-docgen/pull/848) |
| 35 | + [`dda8915`](https://github.com/reactjs/react-docgen/commit/dda8915ce9f8d5065372570d590405f2c2403bd8) |
| 36 | + Thanks [@danez](https://github.com/danez)! - Drop support for Node.js |
| 37 | + version 14. |
| 38 | + |
| 39 | + The minimum supported version is now 16.14.0 |
| 40 | + |
| 41 | +- [#846](https://github.com/reactjs/react-docgen/pull/846) |
| 42 | + [`62e692f`](https://github.com/reactjs/react-docgen/commit/62e692fcca6f3d17dcf81ce72f2db1a95b2d694b) |
| 43 | + Thanks [@danez](https://github.com/danez)! - `resolveToValue` will not resolve |
| 44 | + to `ImportDeclaration` anymore but instead to one of the possible specifiers |
| 45 | + (`ImportSpecifier`, `ImportDefaultSpecifier` or `ImportNamespaceSpecifier`). |
| 46 | + This gives better understanding to which specifier exactly `resolveToValue` |
| 47 | + did resolve a NodePath to. |
| 48 | + |
| 49 | + Here is a possible easy fix for this in a code snippet that uses |
| 50 | + `resolveToValue` |
| 51 | + |
| 52 | + ```diff |
| 53 | + const resolved = resolveToValue(path); |
| 54 | + |
| 55 | + -if (resolved.isImportDeclaration()) { |
| 56 | + +if (resolved.parentPath?.isImportDeclaration()) { |
| 57 | + // do smth |
| 58 | + } |
| 59 | + ``` |
| 60 | + |
| 61 | +### Minor Changes |
| 62 | + |
| 63 | +- [#862](https://github.com/reactjs/react-docgen/pull/862) |
| 64 | + [`40ebb00`](https://github.com/reactjs/react-docgen/commit/40ebb0010a7a380f89e0c79a4a937cf9a50a3245) |
| 65 | + Thanks [@danez](https://github.com/danez)! - Support `PropsWithoutRef`, |
| 66 | + `PropsWithRef` and `PropsWithChildren` in TypeScript. |
| 67 | + |
| 68 | + Component props are now detected correctly when these builtin types are used, |
| 69 | + but they do currently not add any props to the documentation. |
| 70 | + |
| 71 | +- [#846](https://github.com/reactjs/react-docgen/pull/846) |
| 72 | + [`82154c3`](https://github.com/reactjs/react-docgen/commit/82154c3b59bf22acf3068165f87b089138fdf7ae) |
| 73 | + Thanks [@danez](https://github.com/danez)! - Add support for `React.FC` in |
| 74 | + TypeScript. |
| 75 | + |
| 76 | +### Patch Changes |
| 77 | + |
| 78 | +- [`6312f2f`](https://github.com/reactjs/react-docgen/commit/6312f2f47b9f679b5bf923a30855e813193ed4af) |
| 79 | + Thanks [@renovate[bot]](https://github.com/renovate%5Bbot%5D)! - update |
| 80 | + dependency @types/doctrine to ^0.0.7 |
| 81 | + |
| 82 | +- [#846](https://github.com/reactjs/react-docgen/pull/846) |
| 83 | + [`c01d1a0`](https://github.com/reactjs/react-docgen/commit/c01d1a00fdba76cea38eebc953fd3d2dd3f12fbd) |
| 84 | + Thanks [@danez](https://github.com/danez)! - Fix detection of react class |
| 85 | + components when super class is imported via named import. |
| 86 | + |
| 87 | +- [#861](https://github.com/reactjs/react-docgen/pull/861) |
| 88 | + [`74b6680`](https://github.com/reactjs/react-docgen/commit/74b6680910037b1b4b64dd57769b652bf775675e) |
| 89 | + Thanks [@renovate](https://github.com/apps/renovate)! - update dependency |
| 90 | + @types/doctrine to ^0.0.8 |
| 91 | + |
| 92 | +- [#846](https://github.com/reactjs/react-docgen/pull/846) |
| 93 | + [`0641700`](https://github.com/reactjs/react-docgen/commit/0641700e4425390c0fe50e216a71e5e18322ab3b) |
| 94 | + Thanks [@danez](https://github.com/danez)! - Remove unnecessary call to |
| 95 | + `resolveToValue` when trying to find props type from react components. |
| 96 | + |
| 97 | +- [#858](https://github.com/reactjs/react-docgen/pull/858) |
| 98 | + [`3be404e`](https://github.com/reactjs/react-docgen/commit/3be404eee6c8fc7bd867fea9d1987b7f438107d6) |
| 99 | + Thanks [@danez](https://github.com/danez)! - Fix detection of React.Children |
| 100 | + with ESM imports |
| 101 | + |
3 | 102 | ## 6.0.4
|
4 | 103 |
|
5 | 104 | ### Patch Changes
|
|
0 commit comments