File tree Expand file tree Collapse file tree
ql/test/library-tests/TypeScript/EmbeddedInScript Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com .semmle .js .extractor ;
22
3+ import java .util .regex .Pattern ;
4+
35import com .semmle .js .extractor .ExtractorConfig .Platform ;
46import com .semmle .js .extractor .ExtractorConfig .SourceType ;
57import com .semmle .js .parser .ParseError ;
68import com .semmle .util .data .StringUtil ;
79import com .semmle .util .trap .TrapWriter ;
810import com .semmle .util .trap .TrapWriter .Label ;
9- import java . util . regex . Pattern ;
11+
1012import net .htmlparser .jericho .Attribute ;
1113import net .htmlparser .jericho .Attributes ;
1214import net .htmlparser .jericho .CharacterReference ;
@@ -143,6 +145,10 @@ private SourceType getScriptSourceType(Element script) {
143145 String scriptType = getAttributeValueLC (script , "type" );
144146 String scriptLanguage = getAttributeValueLC (script , "language" );
145147
148+ if (scriptLanguage == null ) { // Vue templates use 'lang' instead of 'language'.
149+ scriptLanguage = getAttributeValueLC (script , "lang" );
150+ }
151+
146152 // if `type` and `language` are both either missing, contain the
147153 // string "javascript", or if `type` is the string "text/jsx", this is a plain script
148154 if ((scriptType == null || scriptType .contains ("javascript" ) || "text/jsx" .equals (scriptType ))
Original file line number Diff line number Diff line change 1+ classDeclaration
2+ exprType
Original file line number Diff line number Diff line change 1+ import javascript
2+
3+ query ClassDefinition classDeclaration ( ) { any ( ) }
4+
5+ query Type exprType ( Expr e ) { result = e .getType ( ) }
Original file line number Diff line number Diff line change 1+ <script lang='ts'>
2+ export default class MyComponent {
3+ x! : number ;
4+ }
5+ </script >
You can’t perform that action at this time.
0 commit comments