feat: fix types and add type checking plus lazybundle on launch andddd dev flag

This commit is contained in:
Brooklyn Nicholson 2026-04-11 14:42:28 -05:00
parent 5e5e65f6d5
commit 32302c37dd
34 changed files with 1807 additions and 977 deletions

View file

@ -339,8 +339,6 @@ export default class Ink {
}
}
// @ts-expect-error @types/react-reconciler@0.32.3 declares 11 args with transitionCallbacks,
// but react-reconciler 0.33.0 source only accepts 10 args (no transitionCallbacks)
this.container = reconciler.createContainer(
this.rootNode,
ConcurrentRoot,
@ -357,7 +355,7 @@ export default class Ink {
noop // onDefaultTransitionIndicator
)
if ('production' === 'development') {
if (process.env.NODE_ENV === 'development') {
reconciler.injectIntoDevTools({
bundleType: 0,
// Reporting React DOM's version, not Ink's
@ -955,7 +953,6 @@ export default class Ink {
}
pause(): void {
// Flush pending React updates and render before pausing.
// @ts-expect-error flushSyncFromReconciler exists in react-reconciler 0.31 but not in @types/react-reconciler
reconciler.flushSyncFromReconciler()
this.onRender()
this.isPaused = true
@ -1783,9 +1780,7 @@ export default class Ink {
</App>
)
// @ts-expect-error updateContainerSync exists in react-reconciler but not in @types/react-reconciler
reconciler.updateContainerSync(tree, this.container, null, noop)
// @ts-expect-error flushSyncWork exists in react-reconciler but not in @types/react-reconciler
reconciler.flushSyncWork()
}
unmount(error?: Error | number | null): void {
@ -1857,9 +1852,7 @@ export default class Ink {
this.drainTimer = null
}
// @ts-expect-error updateContainerSync exists in react-reconciler but not in @types/react-reconciler
reconciler.updateContainerSync(null, this.container, null, noop)
// @ts-expect-error flushSyncWork exists in react-reconciler but not in @types/react-reconciler
reconciler.flushSyncWork()
instances.delete(this.options.stdout)
@ -1966,8 +1959,8 @@ export default class Ink {
const intercept = (
chunk: Uint8Array | string,
encodingOrCb?: BufferEncoding | ((err?: Error) => void),
cb?: (err?: Error) => void
encodingOrCb?: BufferEncoding | ((err?: Error | null) => void),
cb?: (err?: Error | null) => void
): boolean => {
const callback = typeof encodingOrCb === 'function' ? encodingOrCb : cb