javascript - Attempted import error:' is not exported from - Stack Overflow

i cant resolve my problem. I have a file where I declare a class with the following code in lama.d.tse

i cant resolve my problem. I have a file where I declare a class with the following code in lama.d.ts

export declare class lama  {


    // code here
}

Then I import this in another file in the same folder of my react project

import { lama} from './lama.d';

But I have the following error : Attempted import error: 'lama' is not exported from './lama.d'.

It does the same in a .ts instead of .d.ts file. And the mostt weird is that if I export another class from this file (lama.d.ts) that I import from another file to lama.d.ts , it works , but not the class that i wantt to work.

thank you for reading me

i cant resolve my problem. I have a file where I declare a class with the following code in lama.d.ts

export declare class lama  {


    // code here
}

Then I import this in another file in the same folder of my react project

import { lama} from './lama.d';

But I have the following error : Attempted import error: 'lama' is not exported from './lama.d'.

It does the same in a .ts instead of .d.ts file. And the mostt weird is that if I export another class from this file (lama.d.ts) that I import from another file to lama.d.ts , it works , but not the class that i wantt to work.

thank you for reading me

Share Improve this question asked Dec 14, 2021 at 10:19 LamaLama 311 gold badge3 silver badges5 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 2

I had the same error, but used export default and it worked!


    declare class lama {
      // code here .. 
      export default lama
    }

When import :

    import lama from './lama.d'

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745155720a4614109.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信