打字稿变量类型分组

时间:2017-02-28 11:12:28

标签: typescript

let isie:boolean = (/msie/i).test(navigator.userAgent); //ie
let isie6:boolean = (/msie 6/i).test(navigator.userAgent); //ie 6
let isie7:boolean = (/msie 7/i).test(navigator.userAgent); //ie 7
let isie8:boolean = (/msie 8/i).test(navigator.userAgent); //ie 8
let isie9:boolean = (/msie 9/i).test(navigator.userAgent); //ie 9
let isie10:boolean = (/msie 10/i).test(navigator.userAgent); //ie 9
let isfirefox:boolean = (/firefox/i).test(navigator.userAgent); //firefox
let isapple:boolean = (/applewebkit/i).test(navigator.userAgent); //safari,chrome
let isopera:boolean = (/opera/i).test(navigator.userAgent); //opera
let isios:boolean = (/(ipod|iphone|ipad)/i).test(navigator.userAgent);//ios
let isipad:boolean = (/(ipad)/i).test(navigator.userAgent);//ipad
let isandroid:boolean = (/android/i).test(navigator.userAgent);//android

我正在使用打字稿,
您可以一次为多个变量分组类型吗?

例如,

[isie,isie6,isie7,isie = boolean]

0 个答案:

没有答案