Skip to content

Commit

Permalink
feat(nodes)!: [ImportSpecifier] kind
Browse files Browse the repository at this point in the history
- `ImportKind` -> `ImportSpecifierKind`
- removed `ImportDeclaration#kind`

Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
  • Loading branch information
unicornware committed Mar 11, 2024
1 parent dfcaa41 commit 0c8009b
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 29 deletions.
5 changes: 0 additions & 5 deletions src/nodes/__tests__/declaration-import.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import type {
Data,
ImportKind,
ImportSpecifiers,
Parent,
StringLiteral
Expand Down Expand Up @@ -33,10 +32,6 @@ describe('unit-d:nodes/ImportDeclaration', () => {
.toEqualTypeOf<Optional<SubjectData>>()
})

it('should match [kind: ImportKind]', () => {
expectTypeOf<Subject>().toHaveProperty('kind').toEqualTypeOf<ImportKind>()
})

it('should match [type: "importDeclaration"]', () => {
expectTypeOf<Subject>()
.toHaveProperty('type')
Expand Down
7 changes: 7 additions & 0 deletions src/nodes/__tests__/specifier-import.spec-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import type {
Data,
Identifier,
ImportSpecifierKind,
Parent,
StringLiteral
} from '@flex-development/esast'
Expand All @@ -32,6 +33,12 @@ describe('unit-d:nodes/ImportSpecifier', () => {
.toEqualTypeOf<Optional<SubjectData>>()
})

it('should match [kind: ImportSpecifierKind]', () => {
expectTypeOf<Subject>()
.toHaveProperty('kind')
.toEqualTypeOf<ImportSpecifierKind>()
})

it('should match [type: "importSpecifier"]', () => {
expectTypeOf<Subject>()
.toHaveProperty('type')
Expand Down
8 changes: 0 additions & 8 deletions src/nodes/declaration-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import type {
Data,
ImportKind,
ImportSpecifiers,
Parent,
StringLiteral
Expand Down Expand Up @@ -44,13 +43,6 @@ interface ImportDeclaration extends Parent {
*/
data?: Optional<ImportDeclarationData>

/**
* Import kind.
*
* @see {@linkcode ImportKind}
*/
kind: ImportKind

/**
* Node type.
*/
Expand Down
8 changes: 8 additions & 0 deletions src/nodes/specifier-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import type {
Data,
Identifier,
ImportSpecifierKind,
Parent,
StringLiteral
} from '@flex-development/esast'
Expand Down Expand Up @@ -45,6 +46,13 @@ interface ImportSpecifier extends Parent {
*/
data?: Optional<ImportSpecifierData>

/**
* Import specifier kind.
*
* @see {@linkcode ImportSpecifierKind}
*/
kind: ImportSpecifierKind

/**
* Node type.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
* @file Type Tests - ImportKind
* @module esast/types/tests/unit-d/ImportKind
* @file Type Tests - ImportSpecifierKind
* @module esast/types/tests/unit-d/ImportSpecifierKind
*/

import type TestSubject from '../kind-import'
import type TestSubject from '../kind-import-specifier'

describe('unit-d:types/ImportKind', () => {
describe('unit-d:types/ImportSpecifierKind', () => {
it('should extract "default"', () => {
expectTypeOf<TestSubject>().extract<'default'>().not.toBeNever()
})
Expand Down
2 changes: 1 addition & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type { default as AnyClass } from './any-class'
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'
export type { default as ImportSpecifierKind } from './kind-import-specifier'
export type { default as MethodKind } from './kind-method'
export type { default as PropertyKind } from './kind-property'
export type { default as VariableKind } from './kind-variable'
Expand Down
11 changes: 11 additions & 0 deletions src/types/kind-import-specifier.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @file Type Definitions - ImportSpecifierKind
* @module esast/types/ImportSpecifierKind
*/

/**
* Import specifier kinds.
*/
type ImportSpecifierKind = 'default' | 'named' | 'namespace'

export type { ImportSpecifierKind as default }
11 changes: 0 additions & 11 deletions src/types/kind-import.ts

This file was deleted.

0 comments on commit 0c8009b

Please sign in to comment.