Fix TypeScript strict null check errors
Add optional chaining and null checks in build scripts to handle potentially undefined array elements. Add style prop to Card, Badge, and Placeholder components, and onClick prop to Text component to support inline styling in screen components. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,7 +33,7 @@ Example:
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const toCamelCase = (str: string): string => str.replace(/-([a-z])/g, g => g[1].toUpperCase());
|
||||
const toCamelCase = (str: string): string => str.replace(/-([a-z])/g, g => g[1]!.toUpperCase());
|
||||
|
||||
const parseValue = (value: string): any => {
|
||||
if (value === "true") return true;
|
||||
@@ -48,7 +48,7 @@ const parseValue = (value: string): any => {
|
||||
};
|
||||
|
||||
function parseArgs(): Partial<Bun.BuildConfig> {
|
||||
const config: Partial<Bun.BuildConfig> = {};
|
||||
const config: Record<string, unknown> = {};
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
@@ -82,14 +82,16 @@ function parseArgs(): Partial<Bun.BuildConfig> {
|
||||
|
||||
if (key.includes(".")) {
|
||||
const [parentKey, childKey] = key.split(".");
|
||||
config[parentKey] = config[parentKey] || {};
|
||||
config[parentKey][childKey] = parseValue(value);
|
||||
if (parentKey && childKey) {
|
||||
config[parentKey] = config[parentKey] || {};
|
||||
(config[parentKey] as Record<string, unknown>)[childKey] = parseValue(value);
|
||||
}
|
||||
} else {
|
||||
config[key] = parseValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
return config;
|
||||
return config as Partial<Bun.BuildConfig>;
|
||||
}
|
||||
|
||||
const formatFileSize = (bytes: number): string => {
|
||||
|
||||
Reference in New Issue
Block a user