fix(language-service): remove asserts for non-null expressions (#16422)
Reworked some of the code so asserts are no longer necessary. Added additional and potentially redundant checks Added checks where the null checker found real problems. PR Close #16422
This commit is contained in:

committed by
Miško Hevery

parent
270d694ed2
commit
253345c0c0
@ -170,14 +170,16 @@ export function create(info: any /* ts.server.PluginCreateInfo */): ts.LanguageS
|
||||
}
|
||||
|
||||
function diagnosticToDiagnostic(d: Diagnostic, file: ts.SourceFile): ts.Diagnostic {
|
||||
return {
|
||||
const result = {
|
||||
file,
|
||||
start: d.span.start,
|
||||
length: d.span.end - d.span.start,
|
||||
messageText: d.message,
|
||||
category: ts.DiagnosticCategory.Error,
|
||||
code: 0
|
||||
code: 0,
|
||||
source: 'ng'
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
function tryOperation<T>(attempting: string, callback: () => T): T|null {
|
||||
@ -229,7 +231,7 @@ export function create(info: any /* ts.server.PluginCreateInfo */): ts.LanguageS
|
||||
if (ours) {
|
||||
const displayParts: ts.SymbolDisplayPart[] = [];
|
||||
for (const part of ours.text) {
|
||||
displayParts.push({kind: part.language !, text: part.text});
|
||||
displayParts.push({kind: part.language || 'angular', text: part.text});
|
||||
}
|
||||
const tags = base && (<any>base).tags;
|
||||
base = <any>{
|
||||
|
Reference in New Issue
Block a user