Skip to content

Commit

Permalink
Merge pull request #656 from mjbvz/fix-653
Browse files Browse the repository at this point in the history
Allow 'export default interface'
  • Loading branch information
sheetalkamat authored Aug 21, 2018
2 parents 5fdfb11 + 0ed75f0 commit 5cfc64b
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions TypeScript.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,7 @@ repository:
'3': { name: keyword.control.default.ts }
end: (?=$|{{endOfStatement}})
patterns:
- include: '#interface-declaration'
- include: '#expression'
- name: meta.export.ts
begin: '{{startOfIdentifier}}(export)(?!\s*:){{endOfIdentifier}}'
Expand Down
4 changes: 4 additions & 0 deletions TypeScript.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -3545,6 +3545,10 @@
<string>(?=$|;|^\s*abstract\b|^\s*async\b|^\s*class\b|^\s*const\b|^\s*declare\b|^\s*enum\b|^\s*export\b|^\s*function\b|^\s*import\b|^\s*interface\b|^\s*let\b|^\s*module\b|^\s*namespace\b|^\s*return\b|^\s*type\b|^\s*var\b)</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#interface-declaration</string>
</dict>
<dict>
<key>include</key>
<string>#expression</string>
Expand Down
4 changes: 4 additions & 0 deletions TypeScriptReact.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -3549,6 +3549,10 @@
<string>(?=$|;|^\s*abstract\b|^\s*async\b|^\s*class\b|^\s*const\b|^\s*declare\b|^\s*enum\b|^\s*export\b|^\s*function\b|^\s*import\b|^\s*interface\b|^\s*let\b|^\s*module\b|^\s*namespace\b|^\s*return\b|^\s*type\b|^\s*var\b)</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#interface-declaration</string>
</dict>
<dict>
<key>include</key>
<string>#expression</string>
Expand Down
44 changes: 44 additions & 0 deletions tests/baselines/Issue653.baseline.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
original file
-----------------------------------
export default interface IFoo {
x: string;
}
-----------------------------------

Grammar: TypeScript.tmLanguage
-----------------------------------
>export default interface IFoo {
^^^^^^
source.ts meta.export.default.ts keyword.control.export.ts
^
source.ts meta.export.default.ts
^^^^^^^
source.ts meta.export.default.ts keyword.control.default.ts
^
source.ts meta.export.default.ts
^^^^^^^^^
source.ts meta.export.default.ts meta.interface.ts storage.type.interface.ts
^
source.ts meta.export.default.ts meta.interface.ts
^^^^
source.ts meta.export.default.ts meta.interface.ts entity.name.type.interface.ts
^
source.ts meta.export.default.ts meta.interface.ts
^
source.ts meta.export.default.ts meta.interface.ts punctuation.definition.block.ts
> x: string;
^^^^
source.ts meta.export.default.ts meta.interface.ts meta.field.declaration.ts
^
source.ts meta.export.default.ts meta.interface.ts meta.field.declaration.ts meta.definition.property.ts variable.object.property.ts
^
source.ts meta.export.default.ts meta.interface.ts meta.field.declaration.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
^
source.ts meta.export.default.ts meta.interface.ts meta.field.declaration.ts meta.type.annotation.ts
^^^^^^
source.ts meta.export.default.ts meta.interface.ts meta.field.declaration.ts meta.type.annotation.ts support.type.primitive.ts
^
source.ts meta.export.default.ts meta.interface.ts punctuation.terminator.statement.ts
>}
^
source.ts meta.export.default.ts meta.interface.ts punctuation.definition.block.ts
3 changes: 3 additions & 0 deletions tests/cases/Issue653.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default interface IFoo {
x: string;
}

0 comments on commit 5cfc64b

Please sign in to comment.