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.

Custom Element with TypeScript

See original GitHub issue

I see there are type definitions for custom elements, however it’s not immediately clear how to use them.

My index.ts file looks like this:

import Vue from "vue";
import * as VueCustomElement from "vue-custom-element";
import Footer from "./components/footer/codigo-footer.vue";
Vue.use(VueCustomElement);

Vue.customElement('codigo-footer', Footer);

Which is how I would create custom elements in vanilla JS. Vue.customElement is throwing a TypeScript error: Property ‘customElement’ does not exist on type ‘VueConstructor<Vue>’

Am I going about this incorrectly?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
isaaclymancommented, Dec 29, 2017

I’m on vacation for a couple days, but I will definitely look into this when I get home.

4reactions
karol-fcommented, Dec 28, 2017

@isaaclyman Is it possible for You to answer this issue?

It’s regarding this PR https://github.com/karol-f/vue-custom-element/pull/38

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating a Custom Element Decorator Using TypeScript
In the post I showed you how you can build your own TypeScript decorator in order to remove some of custom elements boilerplate...
Read more >
TypeScript 2.1 Custom Elements - Stack Overflow
a shim that allows the native Custom Element API to be used with ES5 (and thus transpiled TypeScript). The release notes for TypeScript...
Read more >
Defining a component - Lit.dev
Define a Lit component by creating a class extending LitElement and registering your class with the browser: @customElement('simple-greeting')
Read more >
How to use Web Components with TypeScript and React
Learn how to use Web Components with TSX TypeScript and React components. ... With the recent support for Custom Elements, we can now...
Read more >
Using custom elements - Web Components | MDN
This article introduces the use of the Custom Elements API. ... reliably be transpiled in Babel 6 or TypeScript targeting legacy browsers.
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