Skip to content

throw error: Unable to compile TypeScript - when check data type by function #1135

@ngvcanh

Description

@ngvcanh

Expected Behavior

Detect the previously returned undefined instance and the other is string

Actual Behavior

Can't understand checked data case it is undefined previously and throw error

Steps to reproduce the problem

Throw error at line 89 in index.ts file.

Minimal reproduction

git clone https://github.com/ngvcanh/node-ts-error.git
cd node-ts-error
npm i
npm start

Specifications

  • ts-node version: 9.0.0
  • node version: 12.16.1
  • TypeScript version: 4.0.3
    tsconfig.json, if you're using one:
{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "strict": true,
    "outDir": "dist",
    "sourceMap": true,
    "baseUrl": "src"
  }
}
  • Operating system and version: Windows 10 x64 - 19041.572
  • If Windows, are you using WSL or WSL2?:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions