Skip to content

Instantly share code, notes, and snippets.

@mthomes
Created March 23, 2018 14:52
Show Gist options
  • Save mthomes/6bea7b307685e5bef0444b798c512686 to your computer and use it in GitHub Desktop.
Save mthomes/6bea7b307685e5bef0444b798c512686 to your computer and use it in GitHub Desktop.
typescript-snippets
{
"Console Log": {
"prefix": "cl",
"body": [
"console.log($0);",
],
"description": "Adds a nice console log statement quicky with just 'log'."
},
"Usage Block": {
"prefix": "usage",
"body": [
"/**",
" * $1",
" *",
" * Usage:",
" * ```",
" $2",
" * ```",
" */",
]
},
"Angular Component Test": {
"prefix": "atest",
"body": [
"import {async, ComponentFixture, TestBed} from '@angular/core/testing';",
"import {$1} from '$2';",
"",
"describe('$1', () => {",
" let component: $1 = null;",
" let fixture: ComponentFixture<$1> = null;",
"",
" beforeEach(async(() => {",
" TestBed.configureTestingModule({",
" imports: [],",
" declarations: [",
" $1,",
" ],",
" providers: [],",
" }).compileComponents();",
" }));",
"",
" beforeEach(() => {",
" fixture = TestBed.createComponent($1);",
" component = fixture.componentInstance;",
" });",
"",
" it('should create the component', async(() => {",
" expect(component).toBeTruthy();",
" }));",
"});",
],
},
"Angular Component": {
"prefix": "acomponent",
"body": [
"import {Component, Input, ViewEncapsulation} from '@angular/core';",
"",
"@Component({",
" selector: '$1-$2',",
" templateUrl: './$2.component.html',",
" styleUrls: ['./$2.component.scss'],",
" encapsulation: ViewEncapsulation.Emulated,",
"})",
"export class $3 {}",
],
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment