4 karma · joined Jan 5, 2022 (4y ago) · 3 submissions
comment 4y ago · link · parent
I never thought about using a Kindle, even though I have an old jailbroken Paperwhite... It fits so much better for this usage, and would certainly have saved me days of working around hardware limitation.
[1]: https://shop.m5stack.com/products/m5paper-esp32-development-...
comment 4y ago · link · parent
I don't know why the type isn't narrowed in Array.filter like it is in if statements without this weird workaround.
const array: (number | string)[] = [];
const mixedArray = array.filter(value => typeof value === 'string');
// mixedArray: (number | string)[]
const arrayOfString = array.filter((value): value is string => typeof value === 'string');
// arrayOfString: string[]
This example in Typescript playground: https://www.typescriptlang.org/play?#code/MYewdgzgLgBAhgJwXA...[1]: https://www.typescriptlang.org/docs/handbook/advanced-types....