@@ -22,7 +22,6 @@ import type {
2222 CommitGroup ,
2323 GeneratedContext
2424} from 'conventional-changelog-writer'
25- import type { ICommit } from 'conventional-commits-parser'
2625import dateformat from 'dateformat'
2726import type mri from 'mri'
2827import {
@@ -38,6 +37,16 @@ import semver from 'semver'
3837import tempfile from 'tempfile'
3938import pkg from '../package.json' assert { type : 'json' }
4039
40+ /**
41+ * Parsed commit with additional fields.
42+ *
43+ * @extends {Commit }
44+ */
45+ interface CommitEnhanced extends Commit {
46+ raw : Commit
47+ version ?: string
48+ }
49+
4150/**
4251 * CLI flags.
4352 */
@@ -235,11 +244,11 @@ sade('changelog', true)
235244 *
236245 * @see https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#commitssort
237246 *
238- * @param {ICommit } a - Commit object
239- * @param {ICommit } b - Commit object to compare to `b`
247+ * @param {Commit } a - Commit object
248+ * @param {Commit } b - Commit object to compare to `b`
240249 * @return {number } Compare result
241250 */
242- commitsSort ( a : ICommit , b : ICommit ) : number {
251+ commitsSort ( a : Commit , b : Commit ) : number {
243252 /**
244253 * Compare result for {@linkcode b.committerDate} and
245254 * {@linkcode a.committerDate}.
@@ -269,32 +278,32 @@ sade('changelog', true)
269278 *
270279 * @param {GeneratedContext } context - Generated changelog context
271280 * @param {Options } options - `conventional-changelog-core` options
272- * @param {ICommit [] } commits - Commits for release
273- * @param {ICommit | undefined } key - Release commit
281+ * @param {CommitEnhanced [] } commits - Commits for release
282+ * @param {CommitEnhanced? } key - Release commit
274283 * @return {GeneratedContext } Final changelog context
275284 */
276285 finalizeContext (
277286 context : GeneratedContext ,
278287 options : Options ,
279- commits : ICommit [ ] ,
280- key : ICommit | undefined
288+ commits : CommitEnhanced [ ] ,
289+ key ?: CommitEnhanced
281290 ) : GeneratedContext {
282291 const { gitSemverTags = [ ] , isPatch, linkCompare, version } = context
283292 let { currentTag, previousTag } = context
284293
285294 /**
286295 * First commit in release.
287296 *
288- * @const {ICommit | undefined } first_commit
297+ * @const {CommitEnhanced? } first_commit
289298 */
290- const first_commit : ICommit | undefined = commits . at ( 0 )
299+ const first_commit : CommitEnhanced | undefined = commits . at ( 0 )
291300
292301 /**
293302 * Last commit in release.
294303 *
295- * @const {ICommit | undefined } last_commit
304+ * @const {CommitEnhanced? } last_commit
296305 */
297- const last_commit : ICommit | undefined = commits . at ( - 1 )
306+ const last_commit : CommitEnhanced | undefined = commits . at ( - 1 )
298307
299308 // set current and previous tags
300309 if ( key && ( ! currentTag || ! previousTag ) ) {
0 commit comments