-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(33511): show jsx namespace default import quick fix if it does no…
…t exists in the current scope
- Loading branch information
1 parent
7ac641d
commit 594c628
Showing
7 changed files
with
176 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @jsx: react | ||
// @module: esnext | ||
// @esModuleInterop: true | ||
// @moduleResolution: node | ||
|
||
// @Filename: /node_modules/react/index.d.ts | ||
////export = React; | ||
////export as namespace React; | ||
////declare namespace React { | ||
//// class Component {} | ||
////} | ||
|
||
// @Filename: /node_modules/react-native/index.d.ts | ||
////import * as React from "react"; | ||
////export class Text extends React.Component {}; | ||
|
||
// @Filename: /a.tsx | ||
////import React from "react"; | ||
////<[|Text|]></Text>; | ||
|
||
goTo.file("/a.tsx"); | ||
verify.codeFix({ | ||
index: 0, | ||
description: `Import 'Text' from module "react-native"`, | ||
newFileContent: | ||
`import React from "react"; | ||
import { Text } from "react-native"; | ||
<Text></Text>;` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @jsx: react | ||
// @module: esnext | ||
// @esModuleInterop: true | ||
// @moduleResolution: node | ||
|
||
// @Filename: /node_modules/react/index.d.ts | ||
////export = React; | ||
////export as namespace React; | ||
////declare namespace React { | ||
//// class Component {} | ||
////} | ||
|
||
// @Filename: /node_modules/react-native/index.d.ts | ||
////import * as React from "react"; | ||
////export class Text extends React.Component {}; | ||
|
||
// @Filename: /a.tsx | ||
////import React from "react"; | ||
////<Text></[|Text|]>; | ||
|
||
goTo.file("/a.tsx"); | ||
verify.codeFix({ | ||
index: 0, | ||
description: `Import 'Text' from module "react-native"`, | ||
newFileContent: | ||
`import React from "react"; | ||
import { Text } from "react-native"; | ||
<Text></Text>;` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @jsx: react | ||
// @module: esnext | ||
// @esModuleInterop: true | ||
// @moduleResolution: node | ||
|
||
// @Filename: /node_modules/react/index.d.ts | ||
////export = React; | ||
////export as namespace React; | ||
////declare namespace React { | ||
//// class Component {} | ||
////} | ||
|
||
// @Filename: /node_modules/react-native/index.d.ts | ||
////import * as React from "react"; | ||
////export class Text extends React.Component {}; | ||
|
||
// @Filename: /a.tsx | ||
////import { Text } from "react-native"; | ||
////<Text></Text>; | ||
|
||
goTo.file("/a.tsx"); | ||
verify.codeFix({ | ||
index: 0, | ||
description: `Import default 'React' from module "react"`, | ||
newFileContent: | ||
`import { Text } from "react-native"; | ||
import React from "react"; | ||
<Text></Text>;` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @jsx: react | ||
// @module: esnext | ||
// @esModuleInterop: true | ||
// @moduleResolution: node | ||
|
||
// @Filename: /node_modules/react/index.d.ts | ||
////export = React; | ||
////export as namespace React; | ||
////declare namespace React { | ||
//// class Component {} | ||
////} | ||
|
||
// @Filename: /node_modules/react-native/index.d.ts | ||
////import * as React from "react"; | ||
////export class Text extends React.Component {}; | ||
|
||
// @Filename: /a.tsx | ||
////import React from "react"; | ||
////<[|Text|] />; | ||
|
||
goTo.file("/a.tsx"); | ||
verify.codeFix({ | ||
index: 0, | ||
description: `Import 'Text' from module "react-native"`, | ||
newFileContent: | ||
`import React from "react"; | ||
import { Text } from "react-native"; | ||
<Text />;` | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @jsx: react | ||
// @module: esnext | ||
// @esModuleInterop: true | ||
// @moduleResolution: node | ||
|
||
// @Filename: /node_modules/react/index.d.ts | ||
////export = React; | ||
////export as namespace React; | ||
////declare namespace React { | ||
//// class Component {} | ||
////} | ||
|
||
// @Filename: /node_modules/react-native/index.d.ts | ||
////import * as React from "react"; | ||
////export class Text extends React.Component {}; | ||
|
||
// @Filename: /a.tsx | ||
////<[|Text|]></Text>; | ||
|
||
goTo.file("/a.tsx"); | ||
verify.codeFix({ | ||
index: 0, | ||
applyChanges: true, | ||
description: `Import 'Text' from module "react-native"`, | ||
newFileContent: | ||
`import { Text } from "react-native"; | ||
<Text></Text>;` | ||
}); | ||
|
||
verify.codeFix({ | ||
description: `Import default 'React' from module "react"`, | ||
newFileContent: | ||
`import { Text } from "react-native"; | ||
import React from "react"; | ||
<Text></Text>;` | ||
}); |