Skip to content

how to import type xxxProps / xxxEmits / xxxSlots #3124

@Dodobibi

Description

@Dodobibi

Description

I need to create custom components including @nuxt/ui components and forward props, emits on this components.

When importing (in vue file)

import type { FormFieldProps, FormFieldSlots } from '@nuxt/ui';

const props = defineProps<FormFieldProps & { operations?: T[] }>();
const slots = defineEmits<FormFieldSlots>();

const formFieldProps = reactiveOmit(props, ['operations']);

I receive this error on execution :

Identifier 'appConfig' has already been declared.

Internal server error: Identifier 'appConfig' has already been declared. (105:6)                                                                                                         09:22:04
  Plugin: vite:vue
  File: .../app/pages/ResDossier/components/MyCustomComponent.vue:105:6
      at toParseError (.../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/parse-error.ts:95:45)
      at raise (.../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/tokenizer/index.ts:1497:19)
      at checkRedeclarationInScope (.../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/util/scope.ts:155:19)
      at declareName (.../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/util/scope.ts:109:12)
      at declareName (.../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/plugins/typescript/scope.ts:89:11)
      at declareNameFromIdentifier (.../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/parser/lval.ts:739:16)
      at checkIdentifier (.../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/parser/lval.ts:734:12)
      at checkLVal (.../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/parser/lval.ts:636:12)
      at parseVarId (.../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/parser/statement.ts:1605:10)
      at parseVarId (.../node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/src/plugins/typescript/index.ts:3463:13)

Is there another way to import theses types ?

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingv3#1289

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions