Skip to content

No error for missing method call  #35557

@mjbvz

Description

@mjbvz

TypeScript Version: 3.8.0-dev.20191206

Search Terms:

  • diagnostics
  • conditional
  • missing function call

Code

import * as fs from 'fs';

fs.stat('/path/to/file', function(err, stats) {
    if (stats.isDirectory) { 
        console.log(`[Directory] ${stats.ctime}`)
    }
});

Expected behavior:
Error on isDirectory. This is a method but it has not been called

Actual behavior:
No error reported.

If I remove the console log line

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions