---
title: defineProps Cannot Access Variables from script setup
impact: MEDIUM
impactDescription: Variables declared in script setup are not accessible inside defineProps arguments
type: gotcha
tags: [vue3, props, script-setup, defineProps, compiler]
---
# defineProps Cannot Access Variables from script setup
**Impact: MEDIUM** - Code inside the `defineProps()` argument cannot access other variables declared in `
```
**Correct:**
```vue
```
## Pattern: Import from External File
```javascript
// validation.js
export const VALID_SIZES = ['sm', 'md', 'lg']
export const VALID_COLORS = ['red', 'blue', 'green']
export const sizeValidator = (v) => VALID_SIZES.includes(v)
```
```vue
```
## Pattern: Dual Script Blocks
```vue
```
## TypeScript: External Type Definitions
```typescript
// types.ts
export interface UserProps {
name: string
email: string
age?: number
}
```
```vue
```
## Why This Happens
Vue's compiler transforms `