mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
20 lines
397 B
TypeScript
20 lines
397 B
TypeScript
//// [tests/cases/compiler/arrayEvery.ts] ////
|
|
|
|
//// [arrayEvery.ts]
|
|
const foo: (number | string)[] = ['aaa'];
|
|
|
|
const isString = (x: unknown): x is string => typeof x === 'string';
|
|
|
|
if (foo.every(isString)) {
|
|
foo[0].slice(0);
|
|
}
|
|
|
|
|
|
//// [arrayEvery.js]
|
|
"use strict";
|
|
const foo = ['aaa'];
|
|
const isString = (x) => typeof x === 'string';
|
|
if (foo.every(isString)) {
|
|
foo[0].slice(0);
|
|
}
|