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)
- Conditionnal return type not recognized inside the function HOT 4
- `importModuleSpecifierPreference: "non-relative"` should use self-name package imports HOT 3
- Design Meeting Notes, 8/13/2024 HOT 7
- Incorrect hover information when initializing a union-typed `const` with `never` HOT 6
- Provide a way to omit first generic parameter when it can be inferred HOT 2
- Unexpected any when using conditional type HOT 12
- KeyboardEvent: Unexpected undefined value of key on autocomplete HOT 5
- Un-initialized class fields are omitted from the emitted JS, compared to the field counterparts in JS HOT 4
- Add typeChecker API to get the inferred type arguments of call expression HOT 2
- Inconsistent Type Inference in Generic Function HOT 7
- Function type expression won't infer the rest parameter type correctly HOT 2
- transpileModule fails when declarationMap is specified HOT 6
- TypeScript can't infer type of default parameters HOT 2
- Allow type annotations in .js files in preparation for Type Annotations proposal
- ts `Move to a new file` doesn't respect `importModuleSpecifier` setting
- Refactor: move to new file does not work HOT 4
- typescript `Move to a new file` doesn't work when namespace import react
- Variables (extracted from a discriminated union object) lose narrowed types after being exported HOT 2
- Number.prototype.toFixed, Number.prototype.toExponential,Number.prototype.toPrecision comments error HOT 3
- Newly introduced type narrowing via discriminators on .filter does not work in this case HOT 9
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.