Skip to content

Latest commit

 

History

History
115 lines (65 loc) · 2.36 KB

ImportedItem.md

File metadata and controls

115 lines (65 loc) · 2.36 KB

ts-sql-codegen / ImportedItem

Interface: ImportedItem

Specifies options to construct an import

Note that unless isRelative is specified as false, the import will be resolved relative to the cwd from where generator is invoked and then converted to a relative path relative to the generated file

Examples: When generated file is located at src/db/tables/some-table.ts and generator is run from project root

Config: { name: "FooAdapter", importPath: 'src/db/adapters/foo-adapter'} Generates: import { FooAdapter } from '../adapters/foo-adapter'

Config: { name: "FooAdapter", isDefault: true, importPath: 'src/db/adapters/foo-adapter'} Generates: import FooAdapter from '../adapters/foo-adapter'

Config: { name: "FooAdapter", isRelative: false, importPath: 'external-lib/foo-adapter'} Generates: import { FooAdapter } from '../adapters';

Hierarchy

  • TypeOf<typeof ImportedItemSchema>

    ImportedItem

Table of contents

Properties

Properties

importPath

Optional importPath: null | string

Path from which we should import

Inherited from

z.TypeOf.importPath

Defined in

src/field-mappings.ts:16


isDefault

Optional isDefault: null | boolean

Whether this is a default import

Default

false

Inherited from

z.TypeOf.isDefault

Defined in

src/field-mappings.ts:23


isRelative

Optional isRelative: null | boolean

Whether this is a relative import

Default

true

Inherited from

z.TypeOf.isRelative

Defined in

src/field-mappings.ts:30


name

name: string

Name of import

Inherited from

z.TypeOf.name

Defined in

src/field-mappings.ts:13

src/field-mappings.ts:13