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

The package isn't "TypeScript-ready" as stated in the docs #90

Open
lukaszarpak opened this issue Feb 2, 2023 · 3 comments
Open

The package isn't "TypeScript-ready" as stated in the docs #90

lukaszarpak opened this issue Feb 2, 2023 · 3 comments

Comments

@lukaszarpak
Copy link

Describe the bug
There aren't any declaration files inside node_modules for this package therefore it doesn't work with Typescript.

To Reproduce
Install the package as described in the docs and try to compile the project with strict flag from TS.

Expected behavior
index.d.ts file should be present inside node_modules/vue-safe-html

Temporary workaround
Add index.d.ts to your vue.js project with following content:

declare module "vue-safe-html" {
  import { Plugin } from "vue";

  declare const plugin: Plugin;
  export default plugin;

  export const allowedTags: string[];
}
@LostCrew
Copy link
Member

Thank you @lukaszarpak for the suggestion. I will add the defs and push a new minor version soon

@matiasah7
Copy link

Is this solved?

@lukaszarpak
Copy link
Author

lukaszarpak commented Aug 19, 2024

@matiasah7 I don't know honestly, I uninstalled in all of my projects and stopped using v-html in general as it's an anti pattern and shouldn't be used.

I my case I only needed v-html to display translation messages with links inside of them but there's a better way to do that - https://vue-i18n.intlify.dev/guide/advanced/component

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants