TS2693

error TS2693: ‘Candlestick‘ only refers to a type, but is being used as a value here.

Bad Code ❌

main.ts

1
2
import Candlestick from "../../chart/Candlestick"
const candle = new Candlestick();

Candlestick.ts

1
2
3
4
5
6
7
8
interface Candlestick {
close: number
high: number
low: number
open: number
}

export default Candlestick

Fixed Code ✔️

main.ts

1
2
import Candlestick from "../../chart/Candlestick"
const candle = new Candlestick();

Candlestick.ts

1
2
3
4
5
6
7
8
class Candlestick {
close: number = 0
high: number = 0
low: number = 0
open: number = 0
}

export default Candlestick