Created
September 19, 2017 23:25
-
-
Save MarkRobertJohnson/5301762043163692f364473fe17f167b to your computer and use it in GitHub Desktop.
Visual Studio snippet for TypeScript property setter and getter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<CodeSnippet Format="1.1.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<Header> | |
<Title>prop</Title> | |
<Author>Mark R. Johnson</Author> | |
<Shortcut>prop</Shortcut> | |
<Description>Code snippet for a property</Description> | |
<SnippetTypes> | |
<SnippetType>Expansion</SnippetType> | |
</SnippetTypes> | |
</Header> | |
<Snippet> | |
<Declarations> | |
<Literal> | |
<ID>type</ID> | |
<Default>string</Default> | |
</Literal> | |
<Literal> | |
<ID>property</ID> | |
<Default>fullName</Default> | |
</Literal> | |
<Literal> | |
<ID>field</ID> | |
<Default>property</Default> | |
</Literal> | |
</Declarations> | |
<Code Language="TypeScript"> | |
<![CDATA[ | |
private _$field$: $type$; | |
get $property$(): $type$ { | |
return this._$field$; | |
} | |
set $property$(value: $type$) { | |
this._$field$ = value; | |
} | |
]]></Code> | |
</Snippet> | |
</CodeSnippet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment