File tree Expand file tree Collapse file tree 4 files changed +62
-3
lines changed
cases/conformance/es6/modules Expand file tree Collapse file tree 4 files changed +62
-3
lines changed Original file line number Diff line number Diff line change @@ -11807,7 +11807,7 @@ namespace ts {
1180711807 // the entire control flow graph from the variable's declaration (i.e. when the flow container and
1180811808 // declaration container are the same).
1180911809 const assumeInitialized = isParameter || isOuterVariable ||
11810- type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & TypeFlags.Any) !== 0 || isInTypeQuery(node)) ||
11810+ type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & TypeFlags.Any) !== 0 || isInTypeQuery(node) || node.parent.kind === SyntaxKind.ExportSpecifier ) ||
1181111811 isInAmbientContext(declaration);
1181211812 const initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, getRootDeclaration(declaration) as VariableLikeDeclaration) : type) :
1181311813 type === autoType || type === autoArrayType ? undefinedType :
Original file line number Diff line number Diff line change 1+ tests/cases/conformance/es6/modules/exportConsts.ts(3,16): error TS2448: Block-scoped variable 'x' used before its declaration.
2+ tests/cases/conformance/es6/modules/exportConsts.ts(3,16): error TS2454: Variable 'x' is used before being assigned.
3+ tests/cases/conformance/es6/modules/exportVars.ts(3,16): error TS2454: Variable 'y' is used before being assigned.
4+
5+
6+ ==== tests/cases/conformance/es6/modules/exportConsts.ts (2 errors) ====
7+ export { x }
8+ export { x as xx }
9+ export default x;
10+ ~
11+ !!! error TS2448: Block-scoped variable 'x' used before its declaration.
12+ ~
13+ !!! error TS2454: Variable 'x' is used before being assigned.
14+
15+ const x = 'x'
16+
17+ export { Y as Z }
18+ class Y {}
19+
20+ ==== tests/cases/conformance/es6/modules/exportVars.ts (1 errors) ====
21+ export { y }
22+ export { y as yy }
23+ export default y;
24+ ~
25+ !!! error TS2454: Variable 'y' is used before being assigned.
26+ var y = 'y'
27+
Original file line number Diff line number Diff line change 1- //// [exportBinding.ts]
1+ //// [tests/cases/conformance/es6/modules/exportBinding.ts] ////
2+
3+ //// [exportConsts.ts]
24export { x }
5+ export { x as xx }
6+ export default x ;
7+
38const x = 'x'
49
510export { Y as Z }
611class Y { }
712
13+ //// [exportVars.ts]
14+ export { y }
15+ export { y as yy }
16+ export default y ;
17+ var y = 'y'
18+
819
9- //// [exportBinding .js]
20+ //// [exportConsts .js]
1021"use strict" ;
1122exports . __esModule = true ;
23+ exports [ "default" ] = x ;
1224var x = 'x' ;
1325exports . x = x ;
26+ exports . xx = x ;
1427var Y = ( function ( ) {
1528 function Y ( ) {
1629 }
1730 return Y ;
1831} ( ) ) ;
1932exports . Z = Y ;
33+ //// [exportVars.js]
34+ "use strict" ;
35+ exports . __esModule = true ;
36+ exports [ "default" ] = y ;
37+ var y = 'y' ;
38+ exports . y = y ;
39+ exports . yy = y ;
Original file line number Diff line number Diff line change 1+ // @filename : exportConsts.ts
2+ // @strict : true
13export { x }
4+ export { x as xx }
5+ export default x ;
6+
27const x = 'x'
38
49export { Y as Z }
510class Y { }
11+
12+ // @filename : exportVars.ts
13+ // @strict : true
14+ export { y }
15+ export { y as yy }
16+ export default y ;
17+ var y = 'y'
You can’t perform that action at this time.
0 commit comments