Skip to content

Instantly share code, notes, and snippets.

@MiKolka7
Created November 17, 2019 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MiKolka7/7d98694edd57715e7b5cf80a0c4d40f2 to your computer and use it in GitHub Desktop.
Save MiKolka7/7d98694edd57715e7b5cf80a0c4d40f2 to your computer and use it in GitHub Desktop.
package.json
const fs = require('fs')
const pathVuex = './node_modules/vuex/types/index.d.ts'
const pathVue = './node_modules/vuex/types/vue.d.ts'
function exitIfErr(err) {
if (err) {
process.exit(1)
}
}
fs.readFile(pathVuex, 'utf8', (err, data) => {
exitIfErr(err)
const res = data
.replace(/(\(type: string, payload\?: any, options\?)/g, '// $1')
.replace(/(<P extends Payload>\(payloadWithType: P)/g, '// $1')
fs.writeFile(pathVuex, res, exitIfErr)
})
fs.readFile(pathVue, 'utf8', (err, data) => {
exitIfErr(err)
const res = data.replace(/(\$store: Store<any>;)/g, '// $1')
fs.writeFile(pathVue, res, exitIfErr)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment