Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/core/Ros.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ import type {
} from "./transport/Transport.js";
import { WebSocketTransportFactory } from "./transport/WebSocketTransportFactory.ts";

interface TypeDefDict {
[key: string]: string | string[] | TypeDefDict | TypeDefDict[];
}
Comment on lines +36 to +38
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

literally wtf is this type lmao


/**
* Manages connection to the rosbridge server and all interactions with ROS.
*
Expand Down Expand Up @@ -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];
Expand Down
12 changes: 1 addition & 11 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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. */,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably move it to the enabled section but if your next PR is to just replace every rule with strict: true then it doesn't really matter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, one sec, I realized this and also that as of this PR we can set strict: true and remove a bunch of these explicit settings


"types": ["@types/node"]
},
Expand Down