MCPcopy Create free account
hub / github.com/srcbookdev/srcbook / tsCategoryToSeverity

Function tsCategoryToSeverity

packages/web/src/components/cells/code.tsx:58–77  ·  view source on GitHub ↗
(
  diagnostic: Pick<TsServerDiagnosticType, 'category' | 'code'>,
)

Source from the content-addressed store, hash-verified

56}
57
58function tsCategoryToSeverity(
59 diagnostic: Pick<TsServerDiagnosticType, 'category' | 'code'>,
60): Diagnostic['severity'] {
61 if (diagnostic.code === 7027) {
62 return 'warning';
63 }
64 // force resolve types with fallback
65 switch (diagnostic.category) {
66 case 'error':
67 return 'error';
68 case 'warning':
69 return 'warning';
70 case 'suggestion':
71 return 'warning';
72 case 'info':
73 return 'info';
74 default:
75 return 'info';
76 }
77}
78
79function isDiagnosticWithLocation(
80 diagnostic: TsServerDiagnosticType,

Callers 1

convertTSDiagnosticToCMFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected