Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Type defined in another file #52

Closed
affanshahid opened this issue Aug 2, 2019 · 7 comments
Closed

Type defined in another file #52

affanshahid opened this issue Aug 2, 2019 · 7 comments

Comments

@affanshahid
Copy link

So I am importing a type from another file and using that as a type in one of my prop declarations:

import Task, { TaskInfo } from './Task';

export interface TaskListProps {
  loading?: boolean;
  tasks?: TaskInfo[]
};

I get the following:
image

Notice the any[]. Am I doing something wrong?

@henck
Copy link

henck commented Aug 30, 2019

I can verify that any type declared in a different file shows up as any.

@sami616
Copy link

sami616 commented Sep 21, 2019

I can verify this is also happening to me

@sergiop
Copy link

sergiop commented Oct 3, 2019

@affanshahid I don't know if it's related, but with this:

type Type = 'default' | 'action' | 'destroy'

export interface ButtonProps {
  label?: string
  type?: Type
}

I get the following:
Schermata 2019-10-03 alle 23 32 06

Instead of this:
Schermata 2019-10-03 alle 23 32 41

@kelly-tock
Copy link

this is different @affanshahid I think but I would like this as well! I have union types defined that I use in multiple places,

export type TextColors = 'DEFAULT' | 'DISABLED';

and I just see TextColors as the description.

@gilbarbara
Copy link

I'm having a similar problem with union types but if I set the property as optional it expands the type...

Screen Shot 2019-11-05 at 21 32 24

@gilbarbara
Copy link

gilbarbara commented Nov 6, 2019

Setting shouldExtractLiteralValuesFromEnum to true in the loader options fixed for me.
🎉

@strothj
Copy link
Owner

strothj commented Feb 9, 2020

For support for enums, some info can be found here:
#87

For loading types from external files:
#80

The documentation was recently updated to include instructions on supporting files loaded from external files. I'm closing this issue but feel free to leave a comment if this is still a problem.

@strothj strothj closed this as completed Feb 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants