forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(58399): [isolatedDeclarations][5.5] Autofix does not work when JS…
…X prop contains a dash (microsoft#58478)
- Loading branch information
1 parent
fece7f1
commit dcec37e
Showing
4 changed files
with
94 additions
and
3 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
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
45 changes: 45 additions & 0 deletions
45
tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports47.ts
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,45 @@ | ||
/// <reference path='fourslash.ts'/> | ||
|
||
// @isolatedDeclarations: true | ||
// @declaration: true | ||
// @moduleResolution: node | ||
// @target: es2018 | ||
// @jsx: react-jsx | ||
|
||
// @filename: node_modules/react/package.json | ||
////{ | ||
//// "name": "react", | ||
//// "types": "index.d.ts", | ||
////} | ||
|
||
// @filename: node_modules/react/index.d.ts | ||
////export = React; | ||
////declare namespace JSX { | ||
//// interface Element extends GlobalJSXElement { } | ||
//// interface IntrinsicElements extends GlobalJSXIntrinsicElements { } | ||
////} | ||
////declare namespace React { } | ||
////declare global { | ||
//// namespace JSX { | ||
//// interface Element { } | ||
//// interface IntrinsicElements { [x: string]: any; } | ||
//// } | ||
////} | ||
////interface GlobalJSXElement extends JSX.Element {} | ||
////interface GlobalJSXIntrinsicElements extends JSX.IntrinsicElements {} | ||
|
||
// @filename: node_modules/react/jsx-runtime.d.ts | ||
////import './'; | ||
|
||
// @filename: node_modules/react/jsx-dev-runtime.d.ts | ||
////import './'; | ||
|
||
// @filename: /a.tsx | ||
////export const x = <div aria-label="label text" />; | ||
|
||
goTo.file("/a.tsx"); | ||
verify.codeFix({ | ||
description: `Add annotation of type 'JSX.Element'`, | ||
index: 0, | ||
newFileContent: 'export const x: JSX.Element = <div aria-label="label text" />;', | ||
}); |
45 changes: 45 additions & 0 deletions
45
tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports48.ts
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,45 @@ | ||
/// <reference path='fourslash.ts'/> | ||
|
||
// @isolatedDeclarations: true | ||
// @declaration: true | ||
// @moduleResolution: node | ||
// @target: es2018 | ||
// @jsx: react-jsx | ||
|
||
// @filename: node_modules/react/package.json | ||
////{ | ||
//// "name": "react", | ||
//// "types": "index.d.ts", | ||
////} | ||
|
||
// @filename: node_modules/react/index.d.ts | ||
////export = React; | ||
////declare namespace JSX { | ||
//// interface Element extends GlobalJSXElement { } | ||
//// interface IntrinsicElements extends GlobalJSXIntrinsicElements { } | ||
////} | ||
////declare namespace React { } | ||
////declare global { | ||
//// namespace JSX { | ||
//// interface Element { } | ||
//// interface IntrinsicElements { [x: string]: any; } | ||
//// } | ||
////} | ||
////interface GlobalJSXElement extends JSX.Element {} | ||
////interface GlobalJSXIntrinsicElements extends JSX.IntrinsicElements {} | ||
|
||
// @filename: node_modules/react/jsx-runtime.d.ts | ||
////import './'; | ||
|
||
// @filename: node_modules/react/jsx-dev-runtime.d.ts | ||
////import './'; | ||
|
||
// @filename: /a.tsx | ||
////export const x = <div aria-label="label text" />; | ||
|
||
goTo.file("/a.tsx"); | ||
verify.codeFix({ | ||
description: `Add satisfies and an inline type assertion with 'JSX.Element'`, | ||
index: 1, | ||
newFileContent: 'export const x = (<div aria-label="label text" />) satisfies JSX.Element as JSX.Element;', | ||
}); |