question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript support

See original GitHub issue

I’m not sure how I would import the Moment type through this package. Would I need to also include the momentjs dependency for types in my project?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:5
  • Comments:10

github_iconTop GitHub Comments

4reactions
jayportacommented, May 1, 2019

This is kind of old but it’s still open. I’m actually here for something else but I worked around lack of @types package by creating vue-moment.d.ts in a /types directory. It contains the following:

import Vue from 'vue'

declare module 'vue/types/vue' {
  interface Vue {
    $moment: any
  }
}

And then in main.ts

Vue.use(moment as any)

3reactions
lifenautjoecommented, Apr 23, 2020

I think this works too given that the moment dependent package already contains extensive typings.

Type declarations:

import Vue from 'vue'
import moment from 'moment';

declare module 'vue/types/vue' {
    interface Vue {
        $moment: typeof moment
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript: JavaScript With Syntax For Types.
TypeScript extends JavaScript by adding types to the language. TypeScript speeds up your development experience by catching errors and providing fixes ...
Read more >
TypeScript - Wikipedia
TypeScript supports definition files that can contain type information of existing JavaScript libraries, much like C++ header files can describe the ...
Read more >
TypeScript Programming with Visual Studio Code
Visual Studio Code includes TypeScript language support but does not include the TypeScript compiler, tsc . You will need to install the TypeScript...
Read more >
TypeScript | IntelliJ IDEA Documentation - JetBrains
IntelliJ IDEA supports developing, running, and debugging TypeScript source code. IntelliJ IDEA recognizes .ts and .tsx files and provides ...
Read more >
TypeScript Introduction - W3Schools
TypeScript is JavaScript with added syntax for types. ... as Visual Studio Code, have built-in TypeScript support and can show errors as you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found