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

Typescript migration #127

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Typescript migration #127

wants to merge 8 commits into from

Conversation

MrWook
Copy link
Collaborator

@MrWook MrWook commented Aug 16, 2021

Let's migrate to typescript

  • add typescript setup

  • move all components to typescript

  • move all js files to typescript

  • resolve build and serve script for typescript

@MrWook MrWook added the enhancement New feature or request label Aug 16, 2021
@MrWook MrWook mentioned this pull request Aug 16, 2021
@mst101
Copy link
Contributor

mst101 commented Aug 25, 2021

@MrWook - thanks for starting this off. I'm pretty buy this week and next, but I've had a quick glance at it and have a couple of initial questions:

  1. What level of browser support are we developing to? I noticed your tsconfig.json file was aimed at es2018 - is that correct?
  2. Is there a particular reason why you've switched to class-based components? It's just that I read that Evan You had abandoned the proposal to use these in Vue 3.

Thanks

@MrWook
Copy link
Collaborator Author

MrWook commented Aug 26, 2021

Hey @mst101

  1. Yes that is correct typescript just compiles the typescript into js in the vue/ts files after that the vue compiler parses the vue files into js and at last babel compile everything into legacy browser formats
  2. Thats because vue 2.x.x has a poor typescript support but with the class-based approach it supports everything

@mst101
Copy link
Contributor

mst101 commented May 6, 2022

@MrWook - I've just revisited the Typescript course I took last year and now my head is full, once again, with generics and decorator functions!

I can see where you're going with the above code, but when I run npm run build, in its current form the build.js file is failing on the babel plugin:

[!] (plugin babel) SyntaxError: /home/mark/repos/vue-datepicker/src/components/PickerCells.vue?rollup-plugin-vue=script.ts: Unexpected token, expected "," (18:37)

  16 | import { Component, Prop } from 'vue-property-decorator'
  17 |
> 18 | const showEdgeDatesValidator = (value: any): boolean => {
     |                                      ^
  19 |   return ['day', 'month', 'year'].includes(value)
  20 | }
  21 |
src/components/PickerCells.vue?rollup-plugin-vue=script.ts (18:37)

It seems like the typescript is not being converted to javascript by the time it reaches the babel transpiler...

Any chance you can help me get over this little hump?

Thanks :-)

@mst101 mst101 mentioned this pull request May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants