-
Notifications
You must be signed in to change notification settings - Fork 9
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
Error with isolatedModules in Create-React-App #2
Comments
I'll look into it in several hours :) |
I've managed to replicate your error by using The way I patched it up and got it working was basically the following:
export declare type TChildren =
| JSX.Element
| string
| number
| boolean
| null
| typeof undefined;
export declare function Choose(props: { children?: TChildren | TChildren[] }): any;
export declare function When(props: { children?: TChildren | TChildren[]; condition: boolean; }): any;
export declare function Otherwise(props: { children?: TChildren | TChildren[] }): any;
export declare function If(props: { children?: TChildren | TChildren[]; condition: boolean; }): any;
export declare function For<T>(props: { children?: TChildren | TChildren[]; each: string; of: Iterable<T>; index?: string; }): any;
export declare function With(props: { children?: TChildren | TChildren[]; [id: string]: any; }): any;
export declare interface IntrinsicAttributes {
children?: TChildren | TChildren[];
}
import { Choose, For, If, Otherwise, When } from './typings/tsx-control-statements.d';
@Garwin4j Let me know if the solution above works for you. Feel free to contact me on gitter. Outside of that, I'll continue working on a solution for the typings. |
Thank you so very much for the reply and the support. Forgive me for my
delay. I will look into it. Thank you very much for you time again.
…On Wed, 20 Mar 2019, 15:48 Konstantin Simeonov, ***@***.***> wrote:
I've managed to replicate your error by using create-react-app with
typescript and I rolled a hacky solution that you can check out in this
example
<https://github.com/KonstantinSimeonov/tsx-control-statements/tree/master/examples/my-app>.
The way I patched it up and got it working was basically the following -
added custom typings to a directory in the src folder:
export declare type TChildren =
| JSX.Element
| string
| number
| boolean
| null
| typeof undefined;
export declare function Choose(props: { children?: TChildren | TChildren[] }): any;
export declare function When(props: { children?: TChildren | TChildren[]; condition: boolean; }): any;
export declare function Otherwise(props: { children?: TChildren | TChildren[] }): any;
export declare function If(props: { children?: TChildren | TChildren[]; condition: boolean; }): any;
export declare function For<T>(props: { children?: TChildren | TChildren[]; each: string; of: Iterable<T>; index?: string; }): any;
export declare function With(props: { children?: TChildren | TChildren[]; [id: string]: any; }): any;
export declare interface IntrinsicAttributes {
children?: TChildren | TChildren[];
}
And then import the control components in the files you're using them like
that:
import { Choose, For, If, Otherwise, When } from './typings/tsx-control-statements.d';
I also had to eject the create-react-app scripts, since I do not know of
another way to configure the build scripts. The only change I did to the
build scripts was adding the tsx-control-statements transformer to the
ts-loader options.
@Garwin4j <https://github.com/Garwin4j> Let me know if the solution above
works for you. Feel free to contact me on gitter. Outside of that, I'll
continue working on a solution for the typings.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAjYW4_FIOkm8ljbzqp4fKszk-gGf51kks5vYp61gaJpZM4b_gwm>
.
|
maybe we need a |
That would work for me since I am using customize-cra now.
…On Thu, 21 Mar 2019, 00:58 TiaossuP, ***@***.***> wrote:
1. I also had to eject the create-react-app scripts, since I do not
know of another way to configure the build scripts. The only change I did
to the build scripts was adding the tsx-control-statements transformer
to the ts-loader options.
maybe we need a addTsLoaderTransfomer function for custimize-cra
<https://github.com/arackaf/customize-cra#customize-cra>, which can
modify webpack config without eject
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAjYW4Z7gsFEvEb-DvRchVplvuwuDzdjks5vYx98gaJpZM4b_gwm>
.
|
@TiaossuP Not forcing users of |
@TiaossuP After some investigation, using The default Some solutions which come to mind:
Regarding the typings, I'll be publishing an updated version of them in the next one or two days. |
a728ad7 introduces stub definitions for the components that are available only during compile time and are stripped by the transformer. These definitions can be imported to appease the typechecker. Examples can be found in the readme, the examples dir (whoa, no wae) and the tests. This should cover the isolated modules error. Regarding the state of integration with |
Hello I get this error with [email protected] ( "react-scripts": ","typescript": "3.3.3333")
I tried to set isolatedModules to false in the tsconfig.json file, but it is set back to true on build.
is there anyway to fix this without setting isolatedModules to false.
NOTE: tried this suggestion in the index.d.tsx file but then my code could find : microsoft/TypeScript#15230 (comment)
The text was updated successfully, but these errors were encountered: