Skip to content

Commit a94eb41

Browse files
committed
fix: fixed some typing for plugin options
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
1 parent b5ee59e commit a94eb41

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/plugin.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,9 @@ export interface CycloneDxWebpackPluginOptions {
130130
collectEvidence?: CycloneDxWebpackPlugin['collectEvidence']
131131
}
132132

133-
class ValidationError extends Error {
134-
readonly details: any
135-
constructor (message: string, details: any) {
136-
super(message)
137-
/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- expected */
138-
this.details = details
139-
}
140-
}
141-
142133
/** @public */
143134
export class CycloneDxWebpackPlugin {
144-
specVersion: CDX.Spec.Version
135+
specVersion: CDX.Spec.Version | `${CDX.Spec.Version}`
145136
reproducibleResults: boolean
146137
validateResults: boolean
147138

@@ -150,7 +141,7 @@ export class CycloneDxWebpackPlugin {
150141
resultWellknown: string | undefined
151142

152143
rootComponentAutodetect: boolean
153-
rootComponentType: CDX.Models.Component['type']
144+
rootComponentType: CDX.Models.Component['type'] |`${CDX.Models.Component['type']}`
154145
rootComponentName: CDX.Models.Component['name'] | undefined
155146
rootComponentVersion: CDX.Models.Component['version'] | undefined
156147
rootComponentBuildSystem: CDX.Models.ExternalReference['url'] | undefined
@@ -420,7 +411,8 @@ export class CycloneDxWebpackPlugin {
420411

421412
if (bom.metadata.component !== undefined) {
422413
this.#addRootComponentExtRefs(bom.metadata.component, logger)
423-
bom.metadata.component.type = this.rootComponentType
414+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- ack */
415+
bom.metadata.component.type = this.rootComponentType as CDX.Models.Component['type']
424416
bom.metadata.component.purl = cdxPurlFactory.makeFromComponent(bom.metadata.component)
425417
bom.metadata.component.bomRef.value = bom.metadata.component.purl?.toString()
426418
}
@@ -465,3 +457,12 @@ export class CycloneDxWebpackPlugin {
465457
}
466458
}
467459
}
460+
461+
class ValidationError extends Error {
462+
readonly details: any
463+
constructor (message: string, details: any) {
464+
super(message)
465+
/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- expected */
466+
this.details = details
467+
}
468+
}

0 commit comments

Comments
 (0)