0

I have spent about an hour trying to figure out this error but haven't had any luck.

I have types index.d.ts in folder types. The content of the types looks like this

    export interface tag {
      created_at: string
      id: number
      name: string
    }
    
    export interface task {
      created_at: string
      id: number
      title: string
      updated_at: string
      tags: tag[]
    }
    
    export interface allTaksAndTags {
      tags: tag[]
      tasks: task[]
    }

When I am trying to import them, I am getting following error

Failed to compile.

./src/components/task.tsx Module not found: Can't resolve '../types/index' in '/Users/h/Desktop/timetracking/src/components'

I have attached below the screenshot, Can someone help me in figuring out what I am doing wrong here?

enter image description here enter image description here

1 Answer 1

3

Type definition files are not meant to be used like that.

Remove d.ts in your index file and change its name as index.ts

Type definition files are automatically generated when you build your typescript project.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.