Comments (1)
namespace
declarations come in two forms - instantiated and uninstantiated namespaces. When a namespace has no runtime statements, it is considered uninstantiated, and it therefore has no emit.
You can get an idea of what sorts of statements cause a namespace to be emitted or not (playground link):
namespace n {
// Empty
}
namespace n {
// Types only
type Foo = number;
interface Bar {}
}
namespace n {
// Empty statement
;
}
namespace n {
// Variable declaration
export let x = 10;
}
namespace n {
// Expression statements
x++;
x = x ** 2;
}
namespace n {
// Classes
class C {
}
}
Output:
"use strict";
var n;
(function (n) {
// Empty statement
;
})(n || (n = {}));
(function (n) {
// Variable declaration
n.x = 10;
})(n || (n = {}));
(function (n) {
// Expression statements
n.x++;
n.x = n.x ** 2;
})(n || (n = {}));
(function (n) {
// Classes
class C {
}
})(n || (n = {}));
from typescript.
Related Issues (20)
- Errors compiling runtime agnostic JavaScript to TypeScript HOT 10
- Potentially wrong 'showConfig' results for default values, as it's used in the checker differently. HOT 9
- [5.6-beta] #57196 Searching ancestor and its references for default projects regresses TSServer performance for orphaned files HOT 2
- TS 5.6 Beta `BuiltinIteratorReturn`: can this be the default type argument of `BuiltinIterator`'s `TReturn`? HOT 6
- Detect the use of objects when constructed class is need for getters/setters and functions HOT 2
- [TS 5.6 Beta] Debug Failure. Expected 1661792 <= 1661791 HOT 1
- Conditional type evaluation not deferred when it depends on an implicitly-present type parameter HOT 1
- [NewErrors] 5.6.0-dev.20240728 vs 5.5.4 HOT 70
- [ServerErrors][JavaScript] 5.6.0-dev.20240728 vs 5.5.4 HOT 10
- [ServerErrors][TypeScript] 5.6.0-dev.20240728 vs 5.5.4 HOT 12
- Nested union variant not infered correctly HOT 1
- Project references resolt in multiple dual publish module resolutions
- JSON.parse also works with null, not just a string HOT 1
- `organizeImports` does not merge value and type imports HOT 1
- String template literal CFA does not account for bound variables HOT 2
- Implicit upcasting of static methods with generically constrained `this` allows incorrectly typed operations HOT 1
- Feature that displays method argument names inline does not correctly handle method overloading (so variable name is taken from bad overload, probably from the first method definition). HOT 4
- Paste with imports should not add imports when pasting into a string HOT 3
- Globally installed npm @types packages are no longer respected in standalone JS/TS files HOT 3
- Exhaustiveness checking fails when target is a property in a non-union type object HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript.