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 support? #31

Closed
yooouuri opened this issue Jun 3, 2019 · 12 comments
Closed

Typescript support? #31

yooouuri opened this issue Jun 3, 2019 · 12 comments
Milestone

Comments

@yooouuri
Copy link

yooouuri commented Jun 3, 2019

No description provided.

@acerix
Copy link
Member

acerix commented Jun 3, 2019

Are you looking for TypeScript version as described here?

https://vuejs.org/v2/guide/typescript.html

@tmladek
Copy link

tmladek commented Jun 28, 2019

Right now, trying to import @fullcalendar/vue results in the following error:

TS7016: Could not find a declaration file for module '@fullcalendar/vue'. '/[...]/node_modules/@fullcalendar/vue/main.umd.js' implicitly has an 'any' type.

I assume they mean this, in any case it's the error that brought me here :)

@tmladek
Copy link

tmladek commented Jul 25, 2019

Any news?

@yooouuri
Copy link
Author

We are missing types for fullcalendar vue

@haexhub
Copy link

haexhub commented Nov 3, 2019

Would be really nice if you could provide the types declaration file for typescript support!
Or you write your vue components in a typescript. ;)

Instead of

<script>
  props: {
    user: {
      type: Object
    , required: true
    }
  }

, data: () {
    return {}
  }
</script>
<script lang="ts">
import Vue from 'vue'

interface User {
  firstName: string
  lastName: number
}

export default Vue.extend({
  props: {
    user: {
      type: Object,
      required: true
    } as PropOptions<User>
  }

, data: () {
    return {}
  }

})

You already found the right link. :)
Thank you for your great work so far. :)

@tmladek
Copy link

tmladek commented Nov 25, 2019

Any news yet?

@tmladek
Copy link

tmladek commented Jan 31, 2020

"Latest commit af28b03 on Aug 12, 2019" - is anyone still maintaining this project?

@nadershamma
Copy link

nadershamma commented Feb 20, 2020

Having an issue with this as well, is there a plan to add type definitions?

@nadershamma
Copy link

nadershamma commented Feb 26, 2020

I decided to give this a go, first time writing types definition for a package. I have it working in our project. I'll be honest first time I have written a types defs, was a lot of pocking around until the IDE and compiler stopped complaining but it may not be the right way.

There is an issue around using the $refs api with class based vues, see this stackoverflow thread

So I created an interface type in the defs called FullCalendarComponent to resolve this.

My question now is where do I place these files? shall I stick them in this repo in src and you bundle it up into the package you have on npm or do we create a new package? The former seems the easiest; will probably need a little help with the latter.

@Riplar
Copy link

Riplar commented Mar 5, 2020

A workaround would be to make a typescript definition file where you simply do something like this:

declare module '@fullcalendar/vue';

That way your code compiles, but you still don't have "real" typescript support.

@nadershamma
Copy link

If anyone is looking for type definitions I have submitted some to DefinitelyTyped https://www.npmjs.com/package/@types/fullcalendar__vue

@arshaw
Copy link
Member

arshaw commented Jun 16, 2020

@nadershamma, thank you so much for writing those definitions! They really helped me get oriented while thinking about this issue.

After a bit of investigation, I decided to rewrite the fullcalendar vue connector in TypeScript (a language I love) and have the definitions be auto-generated. Just like what others have suggested in this thread. I already do something like this for the React connector.

This is all available in the release candidate.

Package info: https://www.npmjs.com/package/@fullcalendar/vue/v/5.0.0-rc
Example project: https://github.com/fullcalendar/fullcalendar-example-projects/tree/v5/vue-typescript

Please try these out and report any problems in a separate issue. Thank you!

@arshaw arshaw closed this as completed Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants