mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-18 07:29:16 -05:00
Handle undefined in indent helper (#38217)
* Handle undefined in indent helper Telemetry shows that it's called with undefined (probably `stderr` in an error scenario?). * Add undefined to parameter type
This commit is contained in:
@@ -246,7 +246,9 @@ namespace ts.server.typingsInstaller {
|
||||
const installer = new NodeTypingsInstaller(globalTypingsCacheLocation!, typingSafeListLocation!, typesMapLocation!, npmLocation, validateDefaultNpmLocation, /*throttleLimit*/5, log); // TODO: GH#18217
|
||||
installer.listen();
|
||||
|
||||
function indent(newline: string, str: string): string {
|
||||
return `${newline} ` + str.replace(/\r?\n/, `${newline} `);
|
||||
function indent(newline: string, str: string | undefined): string {
|
||||
return str && str.length
|
||||
? `${newline} ` + str.replace(/\r?\n/, `${newline} `)
|
||||
: "";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user