juitnow / juit-vue-ts-checker

TypeScript and Vue.js checker
Apache License 2.0
3 stars 1 forks source link

Relative module imports do not work #1

Closed lizthegrey closed 3 years ago

lizthegrey commented 3 years ago

When running the command line tool as yarn vue-ts-checker:

TS2307 [ERROR] Cannot find module './home' or its corresponding type declarations.
 | at src/client/Home.vue line 9 col 25
 |
 | import { Identity } from "./home";
 |                          ^^^^^^^^

here's the contents of src/client/Home.vue:

<template>
  <keep-alive>
    <router-view v-if="$route.meta.keepAlive" :identity="identity" />
  </keep-alive>
  <router-view v-if="!$route.meta.keepAlive" :identity="identity" />
</template>

<script lang="ts">
import { Identity } from "./home";

import { defineComponent, PropType } from "vue";
export default defineComponent({
  props: {
    identity: {
      type: Object as PropType<Identity>,
      default: function () {
        return {};
      },
    },
  },
});
</script>

and the partial contents of src/client/home.ts:

export interface Identity {
  account: {
    id: number;
  };
  access: SimpleMap<number>;
  isMember: boolean;
}

My tsconfig has no rootDirs set right now, do I need to instruct vue-ts-checker that the virtual directory from the transpilation of vue to ts is the same as the ts directory?

pfumagalli commented 3 years ago

@lizthegrey, apologies for the belated response, but somehow bugs here don't make it to my inbox and I didn't see this one!

Yes, you are indeed correct. There was a bug in the way files were resolved and relative imports didn't work.

It should have been fixed here:

https://github.com/juitnow/juit-vue-ts-checker/commit/3a4e86b860cf36a6f4f90fc3c2b85b47ab71f77b

1.0.6 should work!

lizthegrey commented 3 years ago

Awesome, thanks! I'll give things another try!