In my component I have an import of my class, Api, and i am attempting to reference its method.
import {Components} from "../components/components";
import {Api} from "../components/api";
export default {
async asyncData ({ params }) {
return {
test : [1,2,3,4],
name : "Hello"
}
},
components : {
SiteHeader : Components.SiteHeader,
SiteFooter : Components.SiteFooter,
},
created : function () {
Api.get("at api");
},
methods : {
addV : function () {
this.test.push(5);
}
}
}
This throws the following error...
39:8-11 "export 'Api' was not found in '../components/api'
export class Api {
public static readonly get = async (name : string) => {
};
}
but if I remove the async...
export class Api {
public static readonly get = (name : string) => {
};
}
then it works fine.
I would assume it has something to do with the way typescript compiles it down.
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1315">#c1315</a>)</em></sub></div>