mowispace/react-native-logs

Type errors with noUncheckedIndexedAccess

Closed this issue · 2 comments

The following example:

import {logger} from "react-native-logs";

const f = logger.createLogger();
f.debug("foo");

Results in:

error TS2722: Cannot invoke an object which is possibly 'undefined'.

 f.debug("foo");
 ~~~~~~~

When compiling to TypeScript with "noUncheckedIndexedAccess": true:
https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess

I added the suggestion in the readme, thank you.