ts-sql-codegen / 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';
-
TypeOf
<typeofImportedItemSchema
>↳
ImportedItem
• Optional
importPath: null
| string
Path from which we should import
z.TypeOf.importPath
• Optional
isDefault: null
| boolean
Whether this is a default import
Default
false
z.TypeOf.isDefault
• Optional
isRelative: null
| boolean
Whether this is a relative import
Default
true
z.TypeOf.isRelative
• name: string
Name of import
z.TypeOf.name