誰も私を説明できません、どうしてこのコードでエラーが発生しないのですか?Typescriptは型にnullを割り当てます。エラーは発生しません
import { Injectable } from '@angular/core';
interface Animal{
name: string;
}
@Injectable()
export class AnimalService {
lion: Animal = null;
constructor() {}
get(){
return this.lion;
}
}
のJavaScript(および活字体)でデフォルトではすべてのフィールドがnullまたは未定義の値を持つことができ、[stricktNullCheck](https://github.com/Microsoft/TypeScriptを見て/プル/ 7140)。 –