Skip to content

Commit 224da6a

Browse files
committed
style: add type imports
1 parent 2c4c5b3 commit 224da6a

16 files changed

+28
-17
lines changed

src/aliases.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { FieldAlias, FieldAliases } from "./types"
2+
13
const aliases: FieldAliases = {
24
name: "name:name|text",
35
fname: "name:fname|text|label:First name",

src/components/VueFormBuilder.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from "../helpers"
1111
import { Parser } from "../parser"
1212
import { ProviderService } from "../provider"
13+
import type { Data, Field } from "../types"
1314

1415
export default defineComponent({
1516
props: {

src/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import "./types"
1+
import type { Data, Field, Model } from "./types"
22

33
export function toTitleCase(str: string): string {
44
return (

src/parser/attributes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { AttributeParser } from "../types"
12
import BooleanAttribute from "./attributes/BooleanAttribute"
23
import InputAttribute from "./attributes/InputAttribute"
34
import OptionsAttribute from "./attributes/OptionsAttribute"

src/parser/attributes/BooleanAttribute.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import "../../types"
1+
import type { Attribute, AttributeParser } from "../../types"
22

33
export default class BooleanAttribute implements AttributeParser {
44
isAttribute(attr: string): boolean {

src/parser/attributes/InputAttribute.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import "../../types"
1+
import type { Attribute, AttributeParser } from "../../types"
22

33
export default class InputAttribute implements AttributeParser {
44
isAttribute(attr: string): boolean {

src/parser/attributes/OptionsAttribute.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { castValue } from "../../helpers"
2+
import type { Attribute, AttributeParser } from "../../types"
23

34
export default class PropsAttribute implements AttributeParser {
45
isAttribute(attr: string): boolean {

src/parser/attributes/PropsAttribute.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import "../../types"
21
import { castValue } from "../../helpers"
2+
import type { Attribute, AttributeParser } from "../../types"
33

44
export default class HtmlAttribute implements AttributeParser {
55
isAttribute(attribute: string): boolean {

src/parser/attributes/TypeAttribute.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import "../../types"
1+
import type { Attribute, AttributeParser } from "../../types"
22

33
export default class TypeAttribute implements AttributeParser {
44
isAttribute(attribute: string): boolean {

src/parser/index.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ import {
88
toTitleCase,
99
} from "../helpers"
1010
import { ProviderService } from "../provider"
11-
import {
12-
type Attribute,
13-
type ComponentProvider,
14-
type Field,
15-
type FieldDescription,
16-
type FieldType,
17-
type FieldValue,
18-
type ParserOptions,
19-
type VueComponent,
20-
type VueComponentProps,
11+
import type {
12+
Attribute,
13+
ComponentProvider,
14+
Field,
15+
FieldDescription,
16+
FieldType,
17+
FieldValue,
18+
ParserOptions,
19+
VueComponent,
20+
VueComponentProps,
2121
} from "../types"
2222

2323
const defaultParserOptions: ParserOptions = {

src/provider/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { ComponentProvider, ProviderName, Providers } from "../types"
12
import {
23
VfbProvider,
34
BootstrapVueProvider,

src/provider/providers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// ----------------------------------------------------------------------------
22
// COMPONENT PROVIDERS
33

4+
import { type ComponentProvider } from "../types"
5+
46
// Dictionary: field type => VueFormBuilder component
57
const VfbProvider: ComponentProvider = {
68
checkboxes: "vfb-checkboxes",

tests/aliases.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { expect, test } from "vitest"
22
import fieldAliases from "../src/aliases"
3+
import type { FieldAlias, FieldAliases } from "../src/types"
34

45
const key = "name"
56
const val: FieldAlias = "name:name|label|Full name|text"

tests/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import CustomFeedback from "./components/CustomFeedback.vue"
55
import CalendarField from "./components/CalendarField.vue"
66
import { components, VueFormBuilder } from "../src/main"
77
import { shuffleArray } from "../src/helpers"
8+
import type { FieldDescription, Model } from "../src/types"
89

910
// ────────────────────────────────────────────────────────────────────────────────
1011
// COMMON VARIABLES USED ACROSS TEST SUITES

tests/files.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ test("it gets the file", async () => {
4848
// it should also contain other data
4949
for (const key of Object.keys(model)) {
5050
const val = model[key]
51-
let payloadVal = null
51+
let payloadVal: any = null
5252

5353
// arrays are dealt differently in form data
5454
if (Array.isArray(val)) payloadVal = payload.getAll(`${key}[]`)

tests/parser.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
veryCustomizedFields,
99
} from "./common"
1010
import { ProviderService } from "../src/provider"
11+
import type { Field } from "../src/types"
1112

1213
const BootstrapVueProvider = ProviderService.getProvider("bootstrap-vue")
1314

@@ -18,7 +19,7 @@ const BootstrapVueProvider = ProviderService.getProvider("bootstrap-vue")
1819
const parser = new Parser()
1920

2021
// this variable will store the parsed fields
21-
let fields = []
22+
let fields: Field[] = []
2223

2324
// ─────────────────────────────────────────────────────────────────────────────
2425
// TESTS

0 commit comments

Comments
 (0)