strictNullChecks (#4666)

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip
This commit is contained in:
syuilo 2019-04-13 01:43:22 +09:00 committed by GitHub
parent 4ee40c3345
commit 987168b863
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
214 changed files with 939 additions and 785 deletions

View file

@ -3,8 +3,6 @@ import { URL } from 'url';
import { urlRegex } from './prelude';
export function fromHtml(html: string): string {
if (html == null) return null;
const dom = parseFragment(html) as DefaultTreeDocumentFragment;
let text = '';

View file

@ -2,7 +2,7 @@ import { mfmLanguage } from './language';
import { MfmForest } from './prelude';
import { normalize } from './normalize';
export function parse(source: string): MfmForest {
export function parse(source: string | null): MfmForest | null {
if (source == null || source == '') {
return null;
}
@ -10,7 +10,7 @@ export function parse(source: string): MfmForest {
return normalize(mfmLanguage.root.tryParse(source));
}
export function parsePlain(source: string): MfmForest {
export function parsePlain(source: string | null): MfmForest | null {
if (source == null || source == '') {
return null;
}

View file

@ -4,7 +4,7 @@ import { intersperse } from '../prelude/array';
import { MfmForest, MfmTree } from './prelude';
import { IMentionedRemoteUsers } from '../models/entities/note';
export function toHtml(tokens: MfmForest, mentionedRemoteUsers: IMentionedRemoteUsers = []) {
export function toHtml(tokens: MfmForest | null, mentionedRemoteUsers: IMentionedRemoteUsers = []) {
if (tokens == null) {
return null;
}