* Use ad-hoc code for nested destructuring in require Nested destructuring doesn't really map to ES imports: ```js const { utils: { nub, intercalate } } = require('./monopackage') ``` Previously, isRequireVariableDeclaration walked up binding elements until it reached a variable declaration. This change instead only walks up one binding element and stops. Then it's not bound as an alias and uses the checker-only code to produce types for the nested-imported identifiers. Fixes #40143 * revert binder formatting change
18 lines
243 B
TypeScript
18 lines
243 B
TypeScript
// @allowJs: true
|
|
// @checkJs: true
|
|
// @outDir: out
|
|
// @declaration: true
|
|
|
|
// @filename: mod1.js
|
|
const chalk = {
|
|
grey: {}
|
|
};
|
|
module.exports.chalk = chalk
|
|
|
|
// @filename: main.js
|
|
const {
|
|
chalk: { grey }
|
|
} = require('./mod1');
|
|
grey
|
|
chalk
|