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
type Inferable<T, K extends keyof T> = T[K] extends Function ? T[K] : never; | |
function asInferable<T, K extends keyof T>(_: T, key: K): (fn: Inferable<T, K>) => void { | |
return function(fn: Inferable<T, K>) { | |
console.log(fn("world")); | |
}; | |
} | |
class Foo { | |
bar(str: string): string { |
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
const sinon = require('sinon'); | |
const { expect } = require('chai'); | |
describe('Timer', () => { | |
it('should verify Date constructor called', () => { | |
let dateSpy = sinon.spy(global, 'Date'); | |
const date = new Date(); | |
expect(dateSpy.calledWithNew()).to.be.true; | |
dateSpy.restore(); | |
}); |
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
var App = Ember.Application.create(); | |
App.Router.map(function(){ | |
this.resource('user'); | |
}); | |
App.UserController = Ember.ObjectController.extend(Ember.Evented, { | |
actions: { | |
submit: function(){ | |
var validation = {isValid: false}; |