This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Mapping<K, V> { | |
_k: K; | |
_v: V; | |
} | |
type P<K, M extends Mapping<K, any>> = M extends Mapping<K, infer V> | |
? V | |
: never; | |
interface XMap<T extends Mapping<any, any> = Mapping<never, undefined>> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue, { VueConstructor } from "vue"; | |
declare function extractInstance<T extends Vue>(Ctor: VueConstructor<T>): T; | |
const Test = Vue.extend({ | |
data() { | |
return { | |
test: 123 | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Store<S> { | |
private vm: Vue | |
constructor(initialState: S) { | |
this.vm = new Vue({ | |
data: initialState | |
}) | |
} | |
get state(): S { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
chainWebpack: webpackConfig => { | |
// prettier-ignore | |
webpackConfig.module | |
.rule('css') | |
.oneOfs.values().forEach(rule => { | |
rule | |
.use('vue-media') | |
.loader('vue-media-loader') | |
.after('postcss-loader') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div v-if="posts.loading">Loading...</div> | |
<ul v-else> | |
<li v-for="p in posts.data" :key="p.id">{{ p.title }}</li> | |
</ul> | |
</template> | |
<script lang="ts"> | |
import Vue from 'vue' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path') | |
const fs = require('fs') | |
const stylus = require('stylus') | |
const compiler = require('vue-template-compiler') | |
const globby = require('globby') | |
const targets = globby.sync(path.resolve(__dirname, '../src/**/*.vue')) | |
targets.forEach(file => { | |
console.log('***** processing: ' + file + ' *****') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as fs from 'fs' | |
import * as path from 'path' | |
import * as globby from 'globby' | |
import { parseComponent } from 'vue-template-compiler' | |
import { format } from 'prettier' | |
import { parse } from '@babel/parser' | |
import traverse from '@babel/traverse' | |
import generate from '@babel/generator' | |
const graphqlCodeGenFile = '../src/generated/graphql.ts' |
OlderNewer