Skip to content

Commit

Permalink
Merge pull request #290 from chantouchsek/fix/289-fix-type-error
Browse files Browse the repository at this point in the history
fix: 🔥 inject a correct type
  • Loading branch information
chantouchsek authored Jul 8, 2022
2 parents 23f7390 + dcfc4a8 commit 87f1994
Show file tree
Hide file tree
Showing 5 changed files with 6,412 additions and 160 deletions.
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"main": "dist/sanitize.js",
"types": "dist/sanitize.d.ts",
"scripts": {
"build": "rimraf dist && npx tsc && cp src/type.d.ts dist",
"build": "rimraf dist && npx tsc",
"release": "standard-version && git push --follow-tags origin main && yarn publish",
"prepublish": "yarn build"
},
Expand Down Expand Up @@ -52,6 +52,7 @@
"@babel/plugin-proposal-object-rest-spread": "^7.15.6",
"@babel/plugin-transform-runtime": "^7.15.0",
"@babel/preset-env": "^7.15.6",
"@nuxt/types": "^2.15.8",
"@types/sanitize-html": "^2.6.2",
"@typescript-eslint/eslint-plugin": "^5.7.0",
"@typescript-eslint/parser": "^5.7.0",
Expand All @@ -60,11 +61,13 @@
"babel-preset-minify": "^0.5.1",
"eslint": "^8.5.0",
"eslint-plugin-vue": "^8.2.0",
"nuxt": "^2.15.8",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"standard-version": "^9.3.1",
"typescript": "^4.5.4",
"vue": "^2.6.14"
"vue": "^2.6.14",
"vuex": "^3.6.2"
},
"publishConfig": {
"access": "public"
Expand Down
20 changes: 19 additions & 1 deletion src/sanitize.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
import sanitizeHtml, {IOptions, defaults, IDefaults} from 'sanitize-html'
import _Vue from "vue";
import './type'

declare module '@nuxt/types' {
interface Context {
$sanitize: Sanitizer;
}
interface NuxtAppOptions {
$sanitize: Sanitizer;
}
}
declare module 'vue/types/vue' {
interface Vue {
$sanitize: Sanitizer;
}
}
declare module 'vue/types/options' {
interface ComponentOptions<V extends _Vue> {
sanitize?: Sanitizer;
}
}

interface Options {
name?: string
Expand Down
21 changes: 0 additions & 21 deletions src/type.d.ts

This file was deleted.

3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"typeRoots": [
"./node_modules/@types"
],
"sourceMap": true,
"types": ["@nuxt/types"],
"sourceMap": true
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/*", "coverage"]
Expand Down
Loading

0 comments on commit 87f1994

Please sign in to comment.