Extends external/imported interfaces/types
See original GitHub issueI see in this plugin test fixtures that it supports generating propTypes from interfaces extending other interface, but only if the extended interface is in the same file.
Is it possible to do the same when the type/interface extends external imported interfaces? Or does this depend on the WIP feature typeCheck
?
import React from 'react';
import { AProps, BProps } from './types';
export interface Props extends AProps, BProps {
name: string;
}
export default function FuncExtendedInterfaces(props: Props) {
return null;
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:19 (9 by maintainers)
Top Results From Across the Web
How to extend an interface declared in an external library d ...
Use the newly defined types from the extended module. ... import 'react'; declare module 'react' { interface OlHTMLAttributes<T> { type?:
Read more >How to extend interfaces declared in external libraries ...
Learn how to extend interfaces declared in external libraries in Typescript by using module augumentation.
Read more >TypeScript Interface Merging And Extending Modules
In the plugin repository types we set things up like shown below. We import 'filepond' and then, declare a module under the same...
Read more >Extending object-like types with interfaces in TypeScript
Extending object-like types with interfaces in TypeScript · Option 1: Declaration merging · Declaration merging to wrangle disparate user ...
Read more >import type can't be used with interface extends #36478
Actual behavior: error TS1361: 'monaco' cannot be used as a value because it was imported using 'import type'. 24 interface MyViewZone extends ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I found this lib: https://github.com/merceyz/typescript-to-proptypes which uses the TS compiler to support conversion of both local and external interfaces. It didn’t match quite my use case (I didn’t want to mutate the input files) and didn’t include a script for generation (just an API), so bundled that into this lib: https://github.com/danReynolds/typescript-proptypes-generator that builds on it for the general purpose of converting TS files containing types/interfaces into an equivalent JS file with propTypes. Use/reference either as needed!
@ethanshar No update. Honestly, I’ll probably never have time to get around to it to do it correctly.