AlbertLucianto / vue-text-highlight

Text highlighter library for Vue.js :lipstick:
https://albertlucianto.github.io/vue-text-highlight
MIT License
326 stars 35 forks source link

Typescript support #39

Open true-eye opened 4 years ago

true-eye commented 4 years ago

Great Library!

I'm using vue.js and typescript. Is there any typescript version for this library?

Please let me know Thanks,

lowbits commented 3 years ago

push

Tryops commented 3 years ago

You can add the line

declare module 'vue-text-highlight';

to your src/shims-vue.d.ts file (or any other src/*.d.ts file in src). Then the component can be used with Vue + Typescript when registered globally (e.g. in main.ts) like this:

import TextHighlight from 'vue-text-highlight'; // import works now
Vue.component('text-highlight', TextHighlight);

That worked for me at least.