TS2693

'Candlestick' only refers to a type, but is being used as a value here.

Broken Code ❌

The error happens when an instance or a constructor is expected but you are providing only the type of something. In the case below the ApiOkResponse decorater expects you to provide a constructor but for the type property but only a type is being provided.

@Get('total')
@ApiOkResponse({ type: number })
total() {
  return this.usersService.getCount();
}

Fixed Code ✔️

To fix the issue, we can make use of a wrapper object for the number type. It's actually one of the few cases where you would need it:

@Get('total')
@ApiOkResponse({ type: Number })
total() {
  return this.usersService.getCount();
}

Broken Code ❌

The error here is that only a type / interface is being exported. Types / interfaces cannot be used with the new keyword as they are not constructors.

Candlestick.ts
interface Candlestick {
  close: number;
  high: number;
  low: number;
  open: number;
}
 
export default Candlestick;
main.ts
import Candlestick from '../../chart/Candlestick';
const candle = new Candlestick();

Fixed Code ✔️

To fix the issue we have to export a class which can then be used to constructed an instance:

Candlestick.ts
class Candlestick {
  close: number = 0;
  high: number = 0;
  low: number = 0;
  open: number = 0;
}
 
export default Candlestick;
main.ts
import Candlestick from '../../chart/Candlestick';
const candle = new Candlestick();