File tree 3 files changed +62
-0
lines changed
3 files changed +62
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * @file Type Tests - Question
3
+ * @module commitlint-config/types/tests/unit-d/Question
4
+ */
5
+
6
+ import type TestSubject from '../question'
7
+ import type QuestionEnum from '../question-enum'
8
+
9
+ describe ( 'unit-d:types/Question' , ( ) => {
10
+ it ( 'should match [description: string]' , ( ) => {
11
+ expectTypeOf < TestSubject > ( ) . toHaveProperty ( 'description' ) . toBeString ( )
12
+ } )
13
+
14
+ it ( 'should match [enum?: { [key in N]: Q }]' , ( ) => {
15
+ expectTypeOf < TestSubject > ( )
16
+ . toHaveProperty ( 'enum' )
17
+ . toEqualTypeOf < { [ key in string ] : QuestionEnum } | undefined > ( )
18
+ } )
19
+
20
+ it ( 'should match [messages?: { [key in string]: string }]' , ( ) => {
21
+ expectTypeOf < TestSubject > ( )
22
+ . toHaveProperty ( 'messages' )
23
+ . toEqualTypeOf < { [ key in string ] : string } | undefined > ( )
24
+ } )
25
+ } )
Original file line number Diff line number Diff line change 4
4
*/
5
5
6
6
export type { default as NoteKeyword } from './note-keyword'
7
+ export type { default as Question } from './question'
7
8
export type { default as QuestionEnum } from './question-enum'
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @file Type Definitions - Question
3
+ * @module commitlint-config/types/Question
4
+ */
5
+
6
+ import type QuestionEnum from './question-enum'
7
+
8
+ /**
9
+ * Object representing a prompt question.
10
+ *
11
+ * @see https://commitlint.js.org/#/reference-prompt?id=questions
12
+ *
13
+ * @template N - Question enum names
14
+ * @template Q - Question enum type
15
+ */
16
+ type Question <
17
+ N extends string = string ,
18
+ Q extends QuestionEnum = QuestionEnum
19
+ > = {
20
+ /**
21
+ * Question description.
22
+ */
23
+ description : string
24
+
25
+ /**
26
+ * Question enums.
27
+ */
28
+ enum ?: { [ key in N ] : Q }
29
+
30
+ /**
31
+ * Message hints.
32
+ */
33
+ messages ?: { [ key in string ] : string }
34
+ }
35
+
36
+ export type { Question as default }
You can’t perform that action at this time.
0 commit comments