chore: improve ide dx in playground (#185)

* chore: improve ide dx in playground

* fix(types): correct builder types
This commit is contained in:
Daniel Roe 2021-03-17 09:11:37 +00:00 committed by GitHub
parent e3aee4bb81
commit 960523c4b8
2 changed files with 4 additions and 3 deletions

View File

@ -17,7 +17,7 @@ export default <Plugin> function ({ app }) {
) )
} }
export function createStore (arg1, arg2) { export function createStore (arg1: any, arg2?: any) {
const store = defineStore(arg1, arg2) const store = defineStore(arg1, arg2)
return () => useStore(store) return () => useStore(store)

View File

@ -1,17 +1,18 @@
import { resolve, extname, relative } from 'path' import { resolve, extname, relative } from 'path'
import { encodePath } from 'ufo' import { encodePath } from 'ufo'
import { NuxtApp } from './app' import { NuxtApp } from './app'
import { Builder } from './builder'
import { resolveFiles } from './utils' import { resolveFiles } from './utils'
// Check if name has [slug] // Check if name has [slug]
export interface NuxtRoute { export interface NuxtRoute {
name: string name?: string
path: string path: string
file: string file: string
children: NuxtRoute[] children: NuxtRoute[]
} }
export async function resolvePagesRoutes (builder, app: NuxtApp) { export async function resolvePagesRoutes (builder: Builder, app: NuxtApp) {
const pagesDir = resolve(app.dir, app.pages!.dir) const pagesDir = resolve(app.dir, app.pages!.dir)
const pagesPattern = `${app.pages!.dir}/**/*.{${app.extensions.join(',')}}` const pagesPattern = `${app.pages!.dir}/**/*.{${app.extensions.join(',')}}`
const files = await resolveFiles(builder, pagesPattern, app.dir) const files = await resolveFiles(builder, pagesPattern, app.dir)