Flow: 0.81.0 type at pos stoped to work with jsx in a lot of situations

Created on 17 Sep 2018  路  5Comments  路  Source: facebook/flow

See example

/* @flow */

import * as React from 'react';
const fn = props => <div root={props.data} />;
fn({ data: { world: true } });

Type at pos on props.data stopped to work in 0.81.0

# 4 40 is cursor on `props.da|ta` where `|` cursor
yarn flow type-at-pos ./utils/tmp.js 4 40

returns

(unknown)

But in 0.80.0 version it returns good result

{|world: boolean|}

Even typed examples like

import * as React from 'react';
const fnn = (props: { data: { world: string } }) => <div root={props.data} />;

stopped to work and gives unknown.

Most helpful comment

Addressed in 64601df2f89ff2057c9899a77958031261508dd9

All 5 comments

@panagosg7 this might be related to porting type-at-pos to the TypedAst d5168fa062ca8febd23cf79ab01798481a5d5328

@jbrown215 It is indeed. I'm planning to add support for JSX in the typed AST this week.

0.82.0 same issue

Working on a fix right now, but it didn't make the current release. Will update here when it's rolled out.

Addressed in 64601df2f89ff2057c9899a77958031261508dd9

Was this page helpful?
0 / 5 - 0 ratings