My file, titled app.ts, contains the following code snippet:
interface Foo {
bar:String;
}
const fn = (foo? :Foo) => foo.bar;
When I run tsc
from the root folder with strict:true
in my tsconfig.json file, I receive an error message like this:
app.ts:5:27 - error TS2532: Object is possibly 'undefined'.
5 const fn = (foo? :Foo) => foo.bar;
However, when I run tsc app.ts
, no errors are displayed and an app.js file is generated. This outcome is unexpected to me. What could be causing this discrepancy?