Description
Describe the bug
Yarn tsc script is causing a lot of errors in the console.
2 import NodeWebSocket from "ws"
~~~~
node_modules/reactotron-core-client/src/plugins/benchmark.ts:10:11 - error TS7034: Variable 'steps' implicitly has type 'any[]' in some locations where its type cannot be determined.
10 const steps = []
~~~~~
node_modules/reactotron-core-client/src/plugins/benchmark.ts:13:54 - error TS7005: Variable 'steps' implicitly has an 'any[]' type.
13 const previousTime = steps.length === 0 ? 0 : (steps[steps.length - 1] as any).time
~~~~~
node_modules/reactotron-core-client/src/plugins/benchmark.ts:20:52 - error TS7005: Variable 'steps' implicitly has an 'any[]' type.
20 reactotron.send("benchmark.report", { title, steps })
~~~~~
Try npm i --save-dev @types/ws
if it exists or add a new declaration (.d.ts) file containing declare module 'ws';
1 import WebSocket from "ws"
~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:104:55 - error TS2344: Type 'CustomCommandArg[] | undefined' does not satisfy the constraint 'CustomCommandArg[]'.
Type 'undefined' is not assignable to type 'CustomCommandArg[]'.
104 onCustomCommand: <Args extends CustomCommandArg[] = CustomCommand["args"]>(
~~~~~~~~~~~~~~~~~~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:166:3 - error TS2416: Property 'options' in type 'ReactotronImpl' is not assignable to the same property in base type 'ReactotronCore'.
Type 'ClientOptions' is not assignable to type 'ClientOptions'.
Type 'this' is not assignable to type 'ReactotronCore'.
Type 'ReactotronImpl' is not assignable to type 'ReactotronCore'.
Types of property 'plugins' are incompatible.
Type 'Plugin[]' is not assignable to type 'Plugin[]'.
Type 'Plugin' is not assignable to type 'Plugin'.
Type 'ReactotronCore' is not assignable to type 'this'.
'this' could be instantiated with an arbitrary type which could be unrelated to 'ReactotronCore'.
166 options: ClientOptions
~~~~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:166:3 - error TS2564: Property 'options' has no initializer and is not definitely assigned in the constructor.
166 options: ClientOptions
~~~~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:224:9 - error TS2322: Type 'null' is not assignable to type '((path: string) => WebSocket) | ((path: string) => NodeWebSocket) | undefined'.
224 createSocket: null,
~~~~~~~~~~~~
node_modules/reactotron-core-client/src/client-options.ts:16:3
16 createSocket?: ((path: string) => BrowserWebSocket) | ((path: string) => NodeWebSocket)
~~~~~~~~~~~~
The expected type comes from property 'createSocket' which is declared here on type 'ClientOptions'
node_modules/reactotron-core-client/src/reactotron-core-client.ts:243:52 - error TS2345: Argument of type 'PluginCreator' is not assignable to parameter of type 'PluginCreator'.
Type 'this' is not assignable to type 'ReactotronCore'.
243 this.options.plugins.forEach((p) => this.use(p))
~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:246:58 - error TS2344: Type 'PluginCreator[] | undefined' does not satisfy the constraint 'PluginCreator[]'.
Type 'undefined' is not assignable to type 'PluginCreator[]'.
246 return this as this & InferFeaturesFromPlugins<this, ClientOptions["plugins"]>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:273:20 - error TS2722: Cannot invoke an object which is possibly 'undefined'.
273 const socket = createSocket(${protocol}://${host}:${port}
)
~~~~~~~~~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:273:20 - error TS18048: 'createSocket' is possibly 'undefined'.
273 const socket = createSocket(${protocol}://${host}:${port}
)
~~~~~~~~~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:285:26 - error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.
285 getClientIdPromise(name).then((clientId) => {
~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:367:27 - error TS7006: Parameter 'evt' implicitly has an 'any' type.
367 socket.onmessage = (evt) => onMessage(evt.data)
~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:464:33 - error TS18048: 'plugin.features' is possibly 'undefined'.
464 const featureFunction = plugin.features[key]
~~~~~~~~~~~~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:477:9 - error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'ReactotronImpl'.
No index signature with a parameter of type 'string' was found on type 'ReactotronImpl'.
477 this[key] = featureFunction
~~~~~~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:503:7 - error TS2322: Type '(() => void) | undefined' is not assignable to type '() => void'.
Type 'undefined' is not assignable to type '() => void'.
503 handler = optHandler
~~~~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:508:7 - error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
508 title = config.title
~~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:509:7 - error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
509 description = config.description
~~~~~~~~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:510:7 - error TS2322: Type 'CustomCommandArg[] | undefined' is not assignable to type 'CustomCommandArg[]'.
Type 'undefined' is not assignable to type 'CustomCommandArg[]'.
510 args = config.args
~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:537:9 - error TS2454: Variable 'args' is used before being assigned.
537 if (args) {
~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:538:13 - error TS7034: Variable 'argNames' implicitly has type 'any[]' in some locations where its type cannot be determined.
538 const argNames = []
~~~~~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:545:13 - error TS7005: Variable 'argNames' implicitly has an 'any[]' type.
545 if (argNames.indexOf(arg.name) > -1) {
~~~~~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:560:7 - error TS2454: Variable 'title' is used before being assigned.
560 title,
~~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:561:7 - error TS2454: Variable 'description' is used before being assigned.
561 description,
~~~~~~~~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:562:7 - error TS2454: Variable 'args' is used before being assigned.
562 args,
~~~~
node_modules/reactotron-core-client/src/reactotron-core-client.ts:595:27 - error TS2345: Argument of type 'unknown' is not assignable to parameter of type 'ClientOptions'.
595 return client.configure(options as unknown) as unknown as Client
~~~~~~~~~~~~~~~~~~
node_modules/reactotron-core-client/src/serialize.ts:52:20 - error TS7006: Parameter 'source' implicitly has an 'any' type.
52 function serialize(source, proxyHack = false) {
~~~~~~
node_modules/reactotron-core-client/src/serialize.ts:53:9 - error TS7034: Variable 'stack' implicitly has type 'any[]' in some locations where its type cannot be determined.
53 const stack = []
~~~~~
node_modules/reactotron-core-client/src/serialize.ts:54:9 - error TS7034: Variable 'keys' implicitly has type 'any[]' in some locations where its type cannot be determined.
54 const keys = []
~~~~
node_modules/reactotron-core-client/src/serialize.ts:62:23 - error TS7006: Parameter 'replacer' implicitly has an 'any' type.
62 function serializer(replacer) {
~~~~~~~~
node_modules/reactotron-core-client/src/serialize.ts:63:33 - error TS7006: Parameter 'key' implicitly has an 'any' type.
63 return function (this: any, key, value) {
~~~
node_modules/reactotron-core-client/src/serialize.ts:63:38 - error TS7006: Parameter 'value' implicitly has an 'any' type.
63 return function (this: any, key, value) {
~~~~~
node_modules/reactotron-core-client/src/serialize.ts:105:25 - error TS7005: Variable 'stack' implicitly has an 'any[]' type.
105 const thisPos = stack.indexOf(this)
~~~~~
node_modules/reactotron-core-client/src/serialize.ts:106:20 - error TS7005: Variable 'stack' implicitly has an 'any[]' type.
106 ~thisPos ? stack.splice(thisPos + 1) : stack.push(this)
~~~~~
node_modules/reactotron-core-client/src/serialize.ts:107:20 - error TS7005: Variable 'keys' implicitly has an 'any[]' type.
107 ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key)
~~~~
node_modules/reactotron-core-client/src/serialize.ts:108:14 - error TS7005: Variable 'stack' implicitly has an 'any[]' type.
108 if (~stack.indexOf(value)) value = CIRCULAR
~~~~~
node_modules/reactotron-core-client/src/stopwatch.ts:18:10 - error TS2304: Cannot find name 'window'.
18 typeof window !== "undefined" &&
~~~~~~
node_modules/reactotron-core-client/src/stopwatch.ts:19:3 - error TS2304: Cannot find name 'window'.
19 window &&
~~~~~~
node_modules/reactotron-core-client/src/stopwatch.ts:20:4 - error TS2304: Cannot find name 'window'.
20 (window.performance || (window as any).msPerformance || (window as any).webkitPerformance)
~~~~~~
node_modules/reactotron-core-client/src/stopwatch.ts:20:27 - error TS2304: Cannot find name 'window'.
20 (window.performance || (window as any).msPerformance || (window as any).webkitPerformance)
~~~~~~
node_modules/reactotron-core-client/src/stopwatch.ts:20:60 - error TS2304: Cannot find name 'window'.
20 (window.performance || (window as any).msPerformance || (window as any).webkitPerformance)
~~~~~~
node_modules/reactotron-core-client/src/stopwatch.ts:30:24 - error TS7053: Element implicitly has an 'any' type because expression of type '1' can't be used to index type 'Number'.
Property '1' does not exist on type 'Number'.
30 delta = (started) => performanceNow(started)[1] / 1000000
~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/reactotron-core-client/src/validate.ts:8:48 - error TS2322: Type 'string | boolean' is not assignable to type 'boolean'.
Type 'string' is not assignable to type 'boolean'.
8 const isHostValid = (host: string): boolean => typeof host === "string" && host && host !== ""
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/reactotron-core-client/src/validate.ts:24:20 - error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.
24 if (!isHostValid(host)) {
~~~~
node_modules/reactotron-core-client/src/validate.ts:28:20 - error TS2345: Argument of type 'number | undefined' is not assignable to parameter of type 'number'.
Type 'undefined' is not assignable to type 'number'.
28 if (!isPortValid(port)) {
~~~~
node_modules/reactotron-core-client/src/validate.ts:32:23 - error TS2345: Argument of type '((command: any) => void) | undefined' is not assignable to parameter of type '(cmd: string) => any'.
Type 'undefined' is not assignable to type '(cmd: string) => any'.
32 if (!onCommandValid(onCommand)) {
~~~~~~~~~
Found 48 errors in 6 files.
Errors Files
1 node_modules/reactotron-core-client/src/client-options.ts:2
3 node_modules/reactotron-core-client/src/plugins/benchmark.ts:10
24 node_modules/reactotron-core-client/src/reactotron-core-client.ts:1
10 node_modules/reactotron-core-client/src/serialize.ts:52
6 node_modules/reactotron-core-client/src/stopwatch.ts:18
4 node_modules/reactotron-core-client/src/validate.ts:8
Reactotron version
5.1.7
Last update:
We can use the desktop app and debug most of the things we want but when we want to customize a bit and import the package of the reactotron in the project this error is triggered. I don't really know why tho.