fix(core): Update types for TypeScript nullability support (#15472)

This commit is contained in:
Miško Hevery
2017-03-29 09:34:45 -07:00
committed by Victor Berchet
parent 331b9f6425
commit 910c0d9ee7
84 changed files with 1287 additions and 1260 deletions

View File

@ -20,8 +20,11 @@ export function html(html: string): Element {
return div;
}
export function multiTrim(text: string): string {
return text.replace(/\n/g, '').replace(/\s\s+/g, ' ').trim();
export function multiTrim(text: string | null | undefined): string {
if (typeof text == 'string') {
return text.replace(/\n/g, '').replace(/\s\s+/g, ' ').trim();
}
throw new Error('Argument can not be undefined.');
}
export function nodes(html: string) {