-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed crash in auto import suggestions for
default
of exported UMD …
…objects (#60313)
- Loading branch information
Showing
5 changed files
with
153 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
51 changes: 51 additions & 0 deletions
51
tests/cases/fourslash/completionsImportDefaultExportCrash2.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,51 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @module: nodenext | ||
// @allowJs: true | ||
|
||
// @Filename: /node_modules/dom7/index.d.ts | ||
//// export interface Dom7Array { | ||
//// length: number; | ||
//// prop(propName: string): any; | ||
//// } | ||
//// | ||
//// export interface Dom7 { | ||
//// (): Dom7Array; | ||
//// fn: any; | ||
//// } | ||
//// | ||
//// declare const Dom7: Dom7; | ||
//// | ||
//// export { | ||
//// Dom7 as $, | ||
//// }; | ||
|
||
// @Filename: /dom7.js | ||
//// import * as methods from 'dom7'; | ||
//// Object.keys(methods).forEach((methodName) => { | ||
//// if (methodName === '$') return; | ||
//// methods.$.fn[methodName] = methods[methodName]; | ||
//// }); | ||
//// | ||
//// export default methods.$; | ||
|
||
// @Filename: /swipe-back.js | ||
//// /*1*/ | ||
|
||
verify.completions({ | ||
marker: "1", | ||
includes: [{ | ||
name: "$", | ||
hasAction: true, | ||
source: 'dom7', | ||
sortText: completion.SortText.AutoImportSuggestions, | ||
}, { | ||
name: "Dom7", | ||
hasAction: true, | ||
source: './dom7', | ||
sortText: completion.SortText.AutoImportSuggestions, | ||
}], | ||
preferences: { | ||
includeCompletionsForModuleExports: true, | ||
} | ||
}); |
49 changes: 49 additions & 0 deletions
49
tests/cases/fourslash/completionsImport_umdDefaultNoCrash1.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,49 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @moduleResolution: node | ||
// @allowJs: true | ||
// @checkJs: true | ||
|
||
// @Filename: /node_modules/dottie/package.json | ||
//// { | ||
//// "name": "dottie", | ||
//// "main": "dottie.js" | ||
//// } | ||
|
||
// @Filename: /node_modules/dottie/dottie.js | ||
//// (function (undefined) { | ||
//// var root = this; | ||
//// | ||
//// var Dottie = function () {}; | ||
//// | ||
//// Dottie["default"] = function (object, path, value) {}; | ||
//// | ||
//// if (typeof module !== "undefined" && module.exports) { | ||
//// exports = module.exports = Dottie; | ||
//// } else { | ||
//// root["Dottie"] = Dottie; | ||
//// root["Dot"] = Dottie; | ||
//// | ||
//// if (typeof define === "function") { | ||
//// define([], function () { | ||
//// return Dottie; | ||
//// }); | ||
//// } | ||
//// } | ||
//// })(); | ||
|
||
// @Filename: /src/index.js | ||
//// /**/ | ||
|
||
verify.completions({ | ||
marker: "", | ||
includes: [ | ||
{ | ||
name: "Dottie", | ||
hasAction: true, | ||
source: "/node_modules/dottie/dottie", | ||
sortText: completion.SortText.AutoImportSuggestions, | ||
}, | ||
], | ||
preferences: { includeCompletionsForModuleExports: true }, | ||
}); |
43 changes: 43 additions & 0 deletions
43
tests/cases/fourslash/completionsImport_umdDefaultNoCrash2.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,43 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
// @moduleResolution: node | ||
// @allowJs: true | ||
// @checkJs: true | ||
|
||
// @Filename: /node_modules/dottie/package.json | ||
//// { | ||
//// "name": "dottie", | ||
//// "main": "dottie.js" | ||
//// } | ||
|
||
// @Filename: /node_modules/dottie/dottie.js | ||
//// (function (undefined) { | ||
//// var root = this; | ||
//// | ||
//// var Dottie = function () {}; | ||
//// | ||
//// Dottie["default"] = function (object, path, value) {}; | ||
//// | ||
//// if (typeof module !== "undefined" && module.exports) { | ||
//// exports = module.exports = Dottie; | ||
//// } else { | ||
//// root["Dottie"] = Dottie; | ||
//// root["Dot"] = Dottie; | ||
//// | ||
//// if (typeof define === "function") { | ||
//// define([], function () { | ||
//// return Dottie; | ||
//// }); | ||
//// } | ||
//// } | ||
//// })(); | ||
|
||
// @Filename: /src/index.js | ||
//// import Dottie from 'dottie'; | ||
//// /**/ | ||
|
||
verify.completions({ | ||
marker: "", | ||
includes: [{ name: "Dottie" }], | ||
preferences: { includeCompletionsForModuleExports: true }, | ||
}); |