Skip to content

Commit

Permalink
feat(interfaces): InspectOptions
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <[email protected]>
  • Loading branch information
unicornware committed Feb 1, 2025
1 parent 5d1924a commit 87fed82
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 6 deletions.
20 changes: 20 additions & 0 deletions src/interfaces/__tests__/inspect-options.spec-d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* @file Type Tests - InspectOptions
* @module log/interfaces/tests/unit-d/InspectOptions
*/

import type TestSubject from '#interfaces/inspect-options'
import type { Nilable } from '@flex-development/tutils'
import type { InspectOptions } from 'node-inspect-extracted'

describe('unit-d:interfaces/InspectOptions', () => {
it('should extend Omit<BaseInspectOptions, "colors">', () => {
expectTypeOf<TestSubject>().toMatchTypeOf<Omit<InspectOptions, 'colors'>>()
})

it('should match [colors?: boolean | null | undefined]', () => {
expectTypeOf<TestSubject>()
.toHaveProperty('colors')
.toEqualTypeOf<Nilable<boolean>>()
})
})
3 changes: 1 addition & 2 deletions src/interfaces/__tests__/log-functions.spec-d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
*/

import type TestSubject from '#interfaces/log-functions'
import type { LogTypeFunctions } from '@flex-development/log'
import type { InspectOptions } from 'node-inspect-extracted'
import type { InspectOptions, LogTypeFunctions } from '@flex-development/log'

describe('unit-d:interfaces/LogFunctions', () => {
it('should extend LogTypeFunctions', () => {
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/index.mts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

export type { default as InputLogObject } from '#interfaces/input-log-object'
export type { default as InspectOptions } from '#interfaces/inspect-options'
export type {
default as LogFormatOptions
} from '#interfaces/log-format-options'
Expand Down
24 changes: 24 additions & 0 deletions src/interfaces/inspect-options.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @file Interfaces - InspectOptions
* @module log/interfaces/InspectOptions
*/

import type * as util from 'node-inspect-extracted'

/**
* Options for using {@linkcode util.inspect} on a value.
*
* @see {@linkcode util.InspectOptions}
*
* @extends {Omit<util.InspectOptions,'colors'>}
*/
interface InspectOptions extends Omit<util.InspectOptions, 'colors'> {
/**
* Use color.
*
* @default isColorSupported()
*/
colors?: boolean | null | undefined
}

export type { InspectOptions as default }
7 changes: 4 additions & 3 deletions src/interfaces/log-functions.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* @module log/interfaces/LogFunctions
*/

import type { LogTypeFunctions } from '@flex-development/log'
import type { InspectOptions, inspect } from 'node-inspect-extracted'
import type { InspectOptions, LogTypeFunctions } from '@flex-development/log'
import type * as util from 'node-inspect-extracted'

/**
* Registry of log functions.
Expand All @@ -15,7 +15,8 @@ import type { InspectOptions, inspect } from 'node-inspect-extracted'
*/
interface LogFunctions extends LogTypeFunctions {
/**
* Use {@linkcode inspect} on `value` and print a string representation.
* Use {@linkcode util.inspect} on `value` and print its string
* representation.
*
* @see {@linkcode InspectOptions}
*
Expand Down
2 changes: 1 addition & 1 deletion src/lib/create-logger.mts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ function bind(
}

/**
* Use {@linkcode util.inspect} on `value` and print a string representation.
* Use {@linkcode util.inspect} on `value` and print its string representation.
*
* @internal
*
Expand Down

0 comments on commit 87fed82

Please sign in to comment.