Skip to content

Commit 6084e69

Browse files
authored
Enable noImplicitAny (#1066)
* Enable `noImplicitAny` * Set `strict: true` and remove implied rules
1 parent ead196e commit 6084e69

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/core/Ros.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ import type {
3333
} from "./transport/Transport.js";
3434
import { WebSocketTransportFactory } from "./transport/WebSocketTransportFactory.ts";
3535

36+
interface TypeDefDict {
37+
[key: string]: string | string[] | TypeDefDict | TypeDefDict[];
38+
}
39+
3640
/**
3741
* Manages connection to the rosbridge server and all interactions with ROS.
3842
*
@@ -641,7 +645,7 @@ export default class Ros extends EventEmitter<
641645
hints: rosapi.TypeDef[],
642646
) => {
643647
// calls itself recursively to resolve type definition using hints.
644-
const typeDefDict = {};
648+
const typeDefDict: TypeDefDict = {};
645649
for (let i = 0; i < theType.fieldnames.length; i++) {
646650
const arrayLen = theType.fieldarraylen[i];
647651
const fieldName = theType.fieldnames[i];

tsconfig.json

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,20 @@
3030
"isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */,
3131

3232
/* Strict Type-Checking Options */
33-
/* Gradually enable more of these until we can enable strict mode. */
34-
"strict": false /* Enable all strict type-checking options. */,
33+
"strict": true /* Enable all strict type-checking options. */,
3534
/* Rules enabled so far */
3635
"allowUnreachableCode": false /* Disable error reporting for unreachable code. */,
3736
"allowUnusedLabels": false /* Disable error reporting for unused labels. */,
38-
"alwaysStrict": true /* Ensure 'use strict' is always emitted. */,
3937
"noFallthroughCasesInSwitch": true /* Enable error reporting for fallthrough cases in switch statements */,
40-
"strictNullChecks": true /* When type checking, take into account `null` and `undefined`. */,
4138
"noImplicitReturns": true /* Enable error reporting for codepaths that do not explicitly return in a function. */,
42-
"noImplicitThis": true /* Enable error reporting when `this` is given the type `any`. */,
4339
"noPropertyAccessFromIndexSignature": true /* Enforces using indexed accessors for keys declared using an indexed type */,
4440
"noUnusedLocals": true /* Enable error reporting when a local variable isn't read. */,
4541
"noUnusedParameters": true /* Raise an error when a function parameter isn't read */,
46-
"strictBindCallApply": true /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */,
47-
"strictBuiltinIteratorReturn": true /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */,
48-
"useUnknownInCatchVariables": true /* Default catch clause variables as `unknown` instead of `any`. */,
49-
"strictFunctionTypes": true /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */,
50-
"strictPropertyInitialization": true /* Check for class properties that are declared but not set in the constructor. */,
5142
"noImplicitOverride": true /* Ensure overriding members in derived classes are marked with an override modifier. */,
5243
"noUncheckedIndexedAccess": true /* Add `undefined` to a type when accessed using an index. */,
5344

5445
/* Rules to be enabled */
5546
"exactOptionalPropertyTypes": false /* Differentiate between undefined and not present when type checking */,
56-
"noImplicitAny": false /* Enable error reporting for expressions and declarations with an implied 'any' type. */,
5747

5848
"types": ["@types/node"]
5949
},

0 commit comments

Comments
 (0)