Quantcast
Channel: Cast name of a class while importing to prevent for "is not a constructor" error - Stack Overflow
Browsing latest articles
Browse All 2 View Live

Answer by Anand Undavia for Cast name of a class while importing to prevent...

const { ResponseObj:response , TYPES:responseTypes } = require(cfg.libs +'message_response');is what you are looking for.More generally,const { exportedKey: newKeyName } = require('something);// use...

View Article



Cast name of a class while importing to prevent for "is not a constructor" error

Is it possibile to cast a name of exported class while importing?export:class ResponseObj {}const TYPES = {}module.exports = { ResponseObj, TYPES };and import:const { response, responseTypes } =...

View Article
Browsing latest articles
Browse All 2 View Live


Latest Images