Strange wrapping with typescript and rest operator Permanently deleted user Created March 09, 2020 21:21 I am not sure what are these grey arrows mean, but I've got this strange wrapping with TypeScript and React in WebStorm. Can I fix this?
what wrapping are you talking about? Is it about code folding, or? Please share a code snippet the issue can be reproduced with
It is about folding, and wrapping to the next line. It happens using Typescript and React Native. So this happens on `.tsx` files
Here is an example of code:
import React, { FC } from 'react';
import { View } from 'react-native';
import { MarkerProps } from 'react-native-maps';
export interface ITeddyMarkerDraggable extends MarkerProps {
}
const TeddyMarkerDraggable: FC<ITeddyMarkerDraggable> = ({
props,
...rest,
}) => <View />;
export default TeddyMarkerDraggable;
And an image to illustrate the issue:
As you can see the spread argument `...rest` is folded in 3 lines. Also not visible on the screenshot, there is a comma on the right of the Type annotation hint
can't reproduce
from your screenshot it seems that the code is not parsed properly. What errors are reported? what IDE version is it?
I am using WebStorm 2019.3.4
Here is code sample without linting errors:
import React, { FC } from 'react';
import { Text, TextProps } from 'react-native';
export interface ITeddyMarkerDraggable extends TextProps {
description: string;
}
const TeddyMarkerDraggable: FC<ITeddyMarkerDraggable> = ({
description,
...rest
}) => {
return <Text {...rest}>{description}</Text>;
};
export default TeddyMarkerDraggable;
I have just realised that it happens only if the window is not large enough:
working version:
problematic version:

Also, I just noticed this only happens with Editor > General > Soft Wraps > Soft-wrap files: * enabled
It seems this issue might be related:
https://youtrack.jetbrains.com/issue/WEB-43954
Please follow https://youtrack.jetbrains.com/issue/WEB-44657 for updates
Thank you very much!