Commit 721287a
committed
fix(types): keep prop-types out of the generated public declarations
tsc was inferring the static propTypes objects as PropTypes.Requireable<...>, which emitted `import PropTypes from 'prop-types'` into the shipped .d.ts and forced consumers to install @types/prop-types — a type dependency the v4.5.0 hand-written typings never had. Annotate both classes' propTypes as {[key: string]: unknown} so the inferred PropTypes types stay out of the declarations. (DraggableCore had this annotation originally; it was dropped in an earlier cleanup, and Draggable never had it.)
Add a Contract 3 to scripts/verify-build.cjs that fails the build if any emitted .d.ts references 'prop-types' — the type-compat test compiles against source (where prop-types resolves) so it cannot catch a consumer-facing leak; this guard inspects the actual artifacts. Verified by installing the packed tarball into a clean project with no @types/prop-types and typechecking a consumer under both bundler and node16 resolution.1 parent 0e32702 commit 721287a
3 files changed
Lines changed: 33 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
59 | 79 | | |
60 | | - | |
| 80 | + | |
61 | 81 | | |
0 commit comments