close

[Solved] TypeError: Class extends value undefined is not a function or null

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error TypeError: Class extends value undefined is not a function or null in javascript. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How TypeError: Class extends value undefined is not a function or null Error Occurs?

Today I get the following error TypeError: Class extends value undefined is not a function or null in javascript.

How To Solve TypeError: Class extends value undefined is not a function or null Error ?

  1. How To Solve TypeError: Class extends value undefined is not a function or null Error ?

    To Solve TypeError: Class extends value undefined is not a function or null Error I had the same problem because my editor auto-imported Entity from the wrong package.
    Once I changed import { Entity } from 'typeorm/decorator/entity/Entity'; back to import { Entity } from 'typeorm'; the error message disappeared.

  2. TypeError: Class extends value undefined is not a function or null

    To Solve TypeError: Class extends value undefined is not a function or null Error I had the same problem because my editor auto-imported Entity from the wrong package.
    Once I changed import { Entity } from 'typeorm/decorator/entity/Entity'; back to import { Entity } from 'typeorm'; the error message disappeared.

Solution 1

As noted in Thomas Jensen’s comment above, circular references can occur not just in Types, but also in files. I encountered this same problem when I was exporting both the base and derived types from the same file. Such as:

// index.ts
export { BaseClass } from "./base";
export { DerivedClass } from "./derived";

This is an easy pitfall to fall into. Posting this here in the hopes it’ll save someone else the debugging time.

Solution 2

I had the same problem because my editor auto-imported Entity from the wrong package.

Once I changed import { Entity } from 'typeorm/decorator/entity/Entity'; back to import { Entity } from 'typeorm'; the error message disappeared.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment