P
P
parse-g2022-02-18 22:28:42
typescript
parse-g, 2022-02-18 22:28:42

Why doesn't import class import work in ts?

I have code

// src/index.ts
export class A {
  constructor(public type) {}
}

// index.ts

import { A } from './src/index.ts'

export class B {
  static C = A
}

// index.js

import { B } from './index'

let obj = new B.C('my obj')

console.log(obj.type)


But on startup it gives an error
// Cannot find module '.\src\array\array' imported from .\index.js 
// Did you mean to import ../src/array.js?


What to do??

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question