Skip to content

Commit

Permalink
fixed more types
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmed committed Aug 31, 2024
1 parent ef47973 commit f4b7680
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/convert-soup-to-gerber-commands/findApertureNumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const findApertureNumber = (
(command): command is DefineAperatureTemplateCommand =>
command.command_code === "ADD" &&
Object.keys(search_params).every(
(param_name) => command[param_name] === search_params[param_name]
(param_name) => command[param_name as keyof typeof search_params] === search_params[param_name as keyof typeof search_params]
)
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/convert-soup-to-gerber-commands/getGerberLayerName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ export const getGerberLayerName = (
layer_type: "copper" | "silkscreen" | "soldermask" | "paste"
): GerberLayerName => {
if (layer_ref === "edgecut") return "Edge_Cuts"
return `${layerRefToGerberPrefix[layer_ref]}${layerTypeToGerberSuffix[layer_type]}` as any
return `${layerRefToGerberPrefix[layer_ref as keyof typeof layerRefToGerberPrefix]}${layerTypeToGerberSuffix[layer_type]}`
}
4 changes: 2 additions & 2 deletions src/convert-soup-to-gerber-commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const convertSoupToGerberCommands = (
}

// Edgecuts has a single aperature
glayers["Edge_Cuts"].push(
glayers.Edge_Cuts.push(
...gerberBuilder()
.add("define_aperture_template", {
aperture_number: 10,
Expand Down Expand Up @@ -194,7 +194,7 @@ export const convertSoupToGerberCommands = (
}

for (const key of Object.keys(glayers)) {
glayers[key].push(...gerberBuilder().add("end_of_file", {}).build())
glayers[key as keyof LayerToGerberCommandsMap].push(...gerberBuilder().add("end_of_file", {}).build())
}

return glayers
Expand Down
3 changes: 2 additions & 1 deletion src/stringify-gerber/stringify-gerber-command.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AnyGerberCommand, gerber_command_map } from "../any_gerber_command"
import type { AnyGerberCommand } from "../any_gerber_command"
import { gerber_command_map } from "../any_gerber_command"

export const stringifyGerberCommand = (command: AnyGerberCommand): string => {
const command_def = Object.values(gerber_command_map).find(
Expand Down

0 comments on commit f4b7680

Please sign in to comment.