Skip to content

Commit be14361

Browse files
committed
fix(core): correct diagnostics type
1 parent ed307f3 commit be14361

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

packages/docs/src/repl/worker/app-bundle-client.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const appBundleClient = async (
5555
const loc = warning.loc;
5656
if (loc && loc.file) {
5757
diagnostic.file = loc.file;
58-
diagnostic.highlights.push({
58+
diagnostic.highlights!.push({
5959
startCol: loc.column,
6060
endCol: loc.column + 1,
6161
startLine: loc.line,

packages/docs/src/repl/worker/app-bundle-ssr.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const appBundleSsr = async (options: ReplInputOptions, result: ReplResult
4545
const loc = warning.loc;
4646
if (loc && loc.file) {
4747
diagnostic.file = loc.file;
48-
diagnostic.highlights.push({
48+
diagnostic.highlights!.push({
4949
startCol: loc.column,
5050
endCol: loc.column + 1,
5151
startLine: loc.line,

packages/docs/src/routes/api/qwik-optimizer/api.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
}
5858
],
5959
"kind": "Interface",
60-
"content": "```typescript\nexport interface Diagnostic \n```\n\n\n<table><thead><tr><th>\n\nProperty\n\n\n</th><th>\n\nModifiers\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\n[category](#)\n\n\n</td><td>\n\n\n</td><td>\n\n[DiagnosticCategory](#diagnosticcategory)\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\n[code](#)\n\n\n</td><td>\n\n\n</td><td>\n\nstring \\| null\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\n[file](#)\n\n\n</td><td>\n\n\n</td><td>\n\nstring\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\n[highlights](#)\n\n\n</td><td>\n\n\n</td><td>\n\n[SourceLocation](#sourcelocation)<!-- -->\\[\\]\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\n[message](#)\n\n\n</td><td>\n\n\n</td><td>\n\nstring\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\n[scope](#)\n\n\n</td><td>\n\n\n</td><td>\n\nstring\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\n[suggestions](#)\n\n\n</td><td>\n\n\n</td><td>\n\nstring\\[\\] \\| null\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>",
60+
"content": "```typescript\nexport interface Diagnostic \n```\n\n\n<table><thead><tr><th>\n\nProperty\n\n\n</th><th>\n\nModifiers\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\n[category](#)\n\n\n</td><td>\n\n\n</td><td>\n\n[DiagnosticCategory](#diagnosticcategory)\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\n[code](#)\n\n\n</td><td>\n\n\n</td><td>\n\nstring \\| null\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\n[file](#)\n\n\n</td><td>\n\n\n</td><td>\n\nstring\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\n[highlights](#)\n\n\n</td><td>\n\n\n</td><td>\n\n[SourceLocation](#sourcelocation)<!-- -->\\[\\] \\| null\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\n[message](#)\n\n\n</td><td>\n\n\n</td><td>\n\nstring\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\n[scope](#)\n\n\n</td><td>\n\n\n</td><td>\n\nstring\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\n[suggestions](#)\n\n\n</td><td>\n\n\n</td><td>\n\nstring\\[\\] \\| null\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>",
6161
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/optimizer/src/types.ts",
6262
"mdFile": "core.diagnostic.md"
6363
},

packages/docs/src/routes/api/qwik-optimizer/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ string
216216

217217
</td><td>
218218

219-
[SourceLocation](#sourcelocation)[]
219+
[SourceLocation](#sourcelocation)[] \| null
220220

221221
</td><td>
222222

packages/qwik/src/optimizer/src/api.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export interface Diagnostic {
2626
// (undocumented)
2727
file: string;
2828
// (undocumented)
29-
highlights: SourceLocation[];
29+
highlights: SourceLocation[] | null;
3030
// (undocumented)
3131
message: string;
3232
// (undocumented)

packages/qwik/src/optimizer/src/plugins/rollup.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,11 @@ export function normalizeRollupOutputOptionsObject(
247247
}
248248

249249
export function createRollupError(id: string, diagnostic: Diagnostic) {
250-
const loc = diagnostic.highlights[0] ?? {};
250+
const loc = diagnostic.highlights?.[0];
251251
const err: Rollup.RollupError = Object.assign(new Error(diagnostic.message), {
252252
id,
253253
plugin: 'qwik',
254-
loc: {
254+
loc: loc && {
255255
column: loc.startCol,
256256
line: loc.startLine,
257257
},

packages/qwik/src/optimizer/src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export interface Diagnostic {
120120
code: string | null;
121121
file: string;
122122
message: string;
123-
highlights: SourceLocation[];
123+
highlights: SourceLocation[] | null;
124124
suggestions: string[] | null;
125125
}
126126

0 commit comments

Comments
 (0)