-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@damassi => Upgrades typescript and enables type emitting #715
Conversation
tsconfig.json
Outdated
"Assets/*": [ | ||
"./Assets/*" | ||
] | ||
"Assets/*": ["./Assets/*"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing we should try to do if possible is use a root directory similar to here so that we don't have to define individual keys.
@l2succes - @zephraph pointed out that the reason decorators might be breaking with babel is because the |
tsconfig.json
Outdated
} | ||
}, | ||
"include": [ | ||
"node_modules/styled-components/typings/styled-components.d.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would moving this under `typeRoots be better? Like
"typeRoots": [
"node_modules/@types",
"node_modules/styled-components/typings/styled-components.d.ts"
]
(not sure)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I removed that line as it was just an experiment to fix TS errors
@l2succes - all good, was just curious if it compiled without errors, but nbd 👍 |
import Title from "./Title" | ||
// @ts-ignore | ||
import TextLink, { LinkProps } from "./TextLink" | ||
// @ts-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@l2succes - I wonder if there is some way we could ignore imported interfaces without having to flag each unused import -- do you know if there is a TSLint / ts config option that would allow us to keep this clean?
Also, i'm pretty sure this is a shot in the dark, but any way to auto-export interfaces?
@orta / @alloy - have y'all ever come across a good way to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@damassi unfortunately, I don't think there's a way to ignore a whole block 😔 (Related: microsoft/TypeScript#19573)
They just fixed the main issue that enables us to emit types in the first place with [email protected] since this issue is related I think they should give us a way to auto-import interfaces when generating types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh cool cool, so I imagine we'll just have to track this as the feature becomes more mature 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are references being imported and then ignored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alloy - in order for the types to be automatically emitted, it needs an in-scope reference to the interface -- in the example above, LinkProps
needs to be made available BUT because we're not using it directly in the code (only during the compilation process) it needs to be ignored due to the noUnusedLocals
setting.
This aspect of type emission kinda bugs me because it clutters up code with some developer vs compiler indirection, but I suspect now that this feature has landed there will be some overall tooling improvements coming soon that will help clean the process up.
@artsy/engineering We just upgraded typescript to export interface IconProps {
name: string;
}
const Icon: React.SFC<IconProps> = props => {
...
} |
@l2succes - Can you update README with some info on type emission and notify #dev since errors due to non-exported types could be confusing? |
This allows us to emit type definitions alongside compiled js files in our reaction builds so consumers that also use typescript (e.g. 'force') have access to them.
TODO
build
from babel 7 back totsc