Skip to content

Instantly share code, notes, and snippets.

View rchaser53's full-sized avatar

rChaser53 rchaser53

View GitHub Profile
@rchaser53
rchaser53 / uniontype.js
Created February 25, 2017 13:23
continueとreturnでのunion typeの挙動
// for文内のcontinueはNG
const abc = (arg: (string | number)[]) => {
for (let i=0;i<arg.length;i++) {
if (typeof arg[i] === 'string') continue;
const abc: number = arg[i];
}
}
// if文のearly returnはOK
const abc2 = (arg: (string | number)[]) => {
@rchaser53
rchaser53 / gist:279cf09a653c8ff781bf0a2f2236db62
Created October 14, 2016 14:22
redo,undoの対象がstateAなのかstateBなのか判断しなければならない例
const stateA = {
idA:{
xx:1
}
}
const stateB = {
idA:{
yy:1
}
}