Triple slash directive is broken #469
See original GitHub issueI saw that #469 issue was resolved by #472 and then changed by #482
For some reason I am now getting the error
[ts]
JSX element type 'MyComponent' is not a constructor function for JSX elements.
Property 'setState' is missing in type 'MyComponent'.
[ts] JSX element class does not support attributes because it does not have a 'props' property.
The generated .d.ts
file looks like the following:
declare module '@mycomponents/components' {
import * as React from 'react';
export interface MyComponentProps {
children: React.ReactNode;
}
export default class MyComponent extends React.Component<MyComponentProps, any> {
render(): JSX.Element;
}
}
If I add
/// <reference types="react" />
Then this solves this issue.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:13 (5 by maintainers)
Top Results From Across the Web
Allowing relative paths in triple slash "types" directives ...
I managed to publish a module with unusable type definitions due to incorrect use of triple slash directives in one of my dependencies....
Read more >Documentation - Triple-Slash Directives - TypeScript
Triple -slash directives are single-line comments containing a single XML tag. The contents of the comment are used as compiler directives.
Read more >How to avoid ugly imports in TS Triple-Slash Directives
1 Answer 1 · ok so in the tsconfig.json I can... include the global.d.ts? · @Ckappo I edited. If you exclude something, all...
Read more >State v. Robinson, 146 S.W.3d 469 | Casetext Search + Citator
As recounted in great detail above, with respect to premeditated murder, the evidence reasonably supports only one of the following conclusions: (1) Robinson ......
Read more >NEMIS HMGP User Manual - Version 3 MR 19.01 - FEMA
NEMIS. The National Emergency Management Information System (NEMIS) is a database system used to track disaster data for FEMA and Recipient ...
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
Thanks, I’ll look into it
Here is the component before it’s been compiled
Here is the output type file
Then when trying to consume this library, I get the following error:
I have also tried to change the call to
generateFromFile
fromto
Where the later just wraps the entire file with
Library versions:
Typescript: v3.2.1 react-to-typescript-definitions: v1.2.0 react: v16.6.3 vscode: Code - Insiders edition