chore(compiler-core): improve types (#2428)
This commit is contained in:
		
							parent
							
								
									6684c6334d
								
							
						
					
					
						commit
						47b3652ecd
					
				@ -29,6 +29,13 @@ import {
 | 
				
			|||||||
type OptionalOptions = 'isNativeTag' | 'isBuiltInComponent'
 | 
					type OptionalOptions = 'isNativeTag' | 'isBuiltInComponent'
 | 
				
			||||||
type MergedParserOptions = Omit<Required<ParserOptions>, OptionalOptions> &
 | 
					type MergedParserOptions = Omit<Required<ParserOptions>, OptionalOptions> &
 | 
				
			||||||
  Pick<ParserOptions, OptionalOptions>
 | 
					  Pick<ParserOptions, OptionalOptions>
 | 
				
			||||||
 | 
					type AttributeValue =
 | 
				
			||||||
 | 
					  | {
 | 
				
			||||||
 | 
					      content: string
 | 
				
			||||||
 | 
					      isQuoted: boolean
 | 
				
			||||||
 | 
					      loc: SourceLocation
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  | undefined
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// The default decoder only provides escapes for characters reserved as part of
 | 
					// The default decoder only provides escapes for characters reserved as part of
 | 
				
			||||||
// the template syntax, and is only used if the custom renderer did not provide
 | 
					// the template syntax, and is only used if the custom renderer did not provide
 | 
				
			||||||
@ -590,13 +597,7 @@ function parseAttribute(
 | 
				
			|||||||
  advanceBy(context, name.length)
 | 
					  advanceBy(context, name.length)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Value
 | 
					  // Value
 | 
				
			||||||
  let value:
 | 
					  let value: AttributeValue = undefined
 | 
				
			||||||
    | {
 | 
					 | 
				
			||||||
        content: string
 | 
					 | 
				
			||||||
        isQuoted: boolean
 | 
					 | 
				
			||||||
        loc: SourceLocation
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    | undefined = undefined
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (/^[\t\r\n\f ]*=/.test(context.source)) {
 | 
					  if (/^[\t\r\n\f ]*=/.test(context.source)) {
 | 
				
			||||||
    advanceSpaces(context)
 | 
					    advanceSpaces(context)
 | 
				
			||||||
@ -702,15 +703,7 @@ function parseAttribute(
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function parseAttributeValue(
 | 
					function parseAttributeValue(context: ParserContext): AttributeValue {
 | 
				
			||||||
  context: ParserContext
 | 
					 | 
				
			||||||
):
 | 
					 | 
				
			||||||
  | {
 | 
					 | 
				
			||||||
      content: string
 | 
					 | 
				
			||||||
      isQuoted: boolean
 | 
					 | 
				
			||||||
      loc: SourceLocation
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  | undefined {
 | 
					 | 
				
			||||||
  const start = getCursor(context)
 | 
					  const start = getCursor(context)
 | 
				
			||||||
  let content: string
 | 
					  let content: string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user