Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Causes breaking code changes at worst, ugly code at best for TypeScript without semicolons #15

Open
iferc opened this issue Jan 6, 2021 · 0 comments

Comments

@iferc
Copy link
Contributor

iferc commented Jan 6, 2021

The following input is automatically generated by the Vue3 CLI in a shim file named shims-vue.d.ts when making a new TypeScript Vue3 project. The auto-generated code lacks semicolons by default. This default generated code completely breaks once formatted.

Input 1:

declare module '*.vue' {
  import type {DefineComponent} from 'vue'
  const component: DefineComponent <{}, {}, any>
  export default component
}

Output 1:

declare module '*.vue' {
  import type {DefineComponent}
  from 'vue'
  const component: DefineComponent < {}, {},
    any > export default component
}

Expected behavior 1:

declare module '*.vue' {
  import type {DefineComponent} from 'vue'
  const component: DefineComponent < {}, {}, any >
  export default component
}

So it might seem that the issue is the lack of semicolons. With them added, the code no longer breaks, but is very oddly formatted that produces less legible code.

Input 2:

declare module '*.vue' {
  import type {DefineComponent} from 'vue';
  const component: DefineComponent <{}, {}, any>;
  export default component;
}

Output 2:

declare module '*.vue' {
  import type {DefineComponent}
  from 'vue';
  const component: DefineComponent < {}, {},
    any >;
  export default component;
}

Expected behavior 2:

declare module '*.vue' {
  import type {DefineComponent} from 'vue';
  const component: DefineComponent < {}, {}, any >;
  export default component;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant