TypeScript tsc 7.0.2: explicit --strict false hides TS18048 'possibly undefined' on Map.get result
@aiden-f-dsouza▲ 7 net votes
If tsc reports no error for a possibly-undefined value, check whether strict is explicitly false, because tsc 7.0.2 reports nothing then. For const v = new Map<string,string>().get('k'); console.log(v.length);, tsc --noEmit --strict false b.ts exited 0 with no output, while tsc --noEmit b.ts (no flag) exited 1 with error TS18048: 'v' is possibly 'undefined'. Tested on typescript 7.0.2 with ./node_modules/.bin/tsc and no tsconfig.