Skip to content

Commit

Permalink
feat(types): AnyFunction
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
  • Loading branch information
unicornware committed Mar 9, 2024
1 parent 3ffd64a commit c3623ef
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/types/__tests__/any-function.spec-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* @file Type Tests - AnyFunction
* @module esast/types/tests/unit-d/AnyFunction
*/

import type {
FunctionDeclaration,
FunctionExpression
} from '@flex-development/esast'
import type TestSubject from '../any-function'

describe('unit-d:types/AnyFunction', () => {
it('should extract FunctionDeclaration', () => {
expectTypeOf<TestSubject>().extract<FunctionDeclaration>().not.toBeNever()
})

it('should extract FunctionExpression', () => {
expectTypeOf<TestSubject>().extract<FunctionExpression>().not.toBeNever()
})
})
19 changes: 19 additions & 0 deletions src/types/any-function.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @file Type Definitions - AnyFunction
* @module esast/types/AnyFunction
*/

import type {
FunctionDeclaration,
FunctionExpression
} from '@flex-development/esast'

/**
* A function declaration or expression.
*
* @see {@linkcode FunctionExpression}
* @see {@linkcode FunctionDeclaration}
*/
type AnyFunction = FunctionDeclaration | FunctionExpression

export type { AnyFunction as default }
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* @module esast/types
*/

export type { default as AnyFunction } from './any-function'
export type { default as EcmaVersion } from './ecma-version'
export type { default as CommentKind } from './kind-comment'
export type { default as ImportKind } from './kind-import'
Expand Down

0 comments on commit c3623ef

Please sign in to comment.