types(compiler-sfc): use specific preprocessLang instead of string (#528)

This commit is contained in:
Pocho 2019-12-10 03:19:39 +08:00 committed by Evan You
parent 9b5c4a2ec1
commit 55e234816e
2 changed files with 6 additions and 3 deletions

View File

@ -5,7 +5,8 @@ import scopedPlugin from './stylePluginScoped'
import { import {
processors, processors,
StylePreprocessor, StylePreprocessor,
StylePreprocessorResults StylePreprocessorResults,
PreprocessLang
} from './stylePreprocessors' } from './stylePreprocessors'
export interface StyleCompileOptions { export interface StyleCompileOptions {
@ -15,7 +16,7 @@ export interface StyleCompileOptions {
map?: object map?: object
scoped?: boolean scoped?: boolean
trim?: boolean trim?: boolean
preprocessLang?: string preprocessLang?: PreprocessLang
preprocessOptions?: any preprocessOptions?: any
postcssOptions?: any postcssOptions?: any
postcssPlugins?: any[] postcssPlugins?: any[]

View File

@ -104,7 +104,9 @@ const styl: StylePreprocessor = {
} }
} }
export const processors: Record<string, StylePreprocessor> = { export type PreprocessLang = 'less' | 'sass' | 'scss' | 'styl' | 'stylus'
export const processors: Record<PreprocessLang, StylePreprocessor> = {
less, less,
sass, sass,
scss, scss,