diff --git a/src/core/Ros.ts b/src/core/Ros.ts index 4a43437fe..0b75188e1 100644 --- a/src/core/Ros.ts +++ b/src/core/Ros.ts @@ -33,6 +33,10 @@ import type { } from "./transport/Transport.js"; import { WebSocketTransportFactory } from "./transport/WebSocketTransportFactory.ts"; +interface TypeDefDict { + [key: string]: string | string[] | TypeDefDict | TypeDefDict[]; +} + /** * Manages connection to the rosbridge server and all interactions with ROS. * @@ -641,7 +645,7 @@ export default class Ros extends EventEmitter< hints: rosapi.TypeDef[], ) => { // calls itself recursively to resolve type definition using hints. - const typeDefDict = {}; + const typeDefDict: TypeDefDict = {}; for (let i = 0; i < theType.fieldnames.length; i++) { const arrayLen = theType.fieldarraylen[i]; const fieldName = theType.fieldnames[i]; diff --git a/tsconfig.json b/tsconfig.json index 06d1bd156..1c9b1ff67 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -30,30 +30,20 @@ "isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */, /* Strict Type-Checking Options */ - /* Gradually enable more of these until we can enable strict mode. */ - "strict": false /* Enable all strict type-checking options. */, + "strict": true /* Enable all strict type-checking options. */, /* Rules enabled so far */ "allowUnreachableCode": false /* Disable error reporting for unreachable code. */, "allowUnusedLabels": false /* Disable error reporting for unused labels. */, - "alwaysStrict": true /* Ensure 'use strict' is always emitted. */, "noFallthroughCasesInSwitch": true /* Enable error reporting for fallthrough cases in switch statements */, - "strictNullChecks": true /* When type checking, take into account `null` and `undefined`. */, "noImplicitReturns": true /* Enable error reporting for codepaths that do not explicitly return in a function. */, - "noImplicitThis": true /* Enable error reporting when `this` is given the type `any`. */, "noPropertyAccessFromIndexSignature": true /* Enforces using indexed accessors for keys declared using an indexed type */, "noUnusedLocals": true /* Enable error reporting when a local variable isn't read. */, "noUnusedParameters": true /* Raise an error when a function parameter isn't read */, - "strictBindCallApply": true /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */, - "strictBuiltinIteratorReturn": true /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */, - "useUnknownInCatchVariables": true /* Default catch clause variables as `unknown` instead of `any`. */, - "strictFunctionTypes": true /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */, - "strictPropertyInitialization": true /* Check for class properties that are declared but not set in the constructor. */, "noImplicitOverride": true /* Ensure overriding members in derived classes are marked with an override modifier. */, "noUncheckedIndexedAccess": true /* Add `undefined` to a type when accessed using an index. */, /* Rules to be enabled */ "exactOptionalPropertyTypes": false /* Differentiate between undefined and not present when type checking */, - "noImplicitAny": false /* Enable error reporting for expressions and declarations with an implied 'any' type. */, "types": ["@types/node"] },