10525 })(Backbone.View)
10526 typedoc.registerComponent(Toggle, 'a[data-toggle]')
10527})(typedoc || (typedoc = {})),
10528(function (typedoc) {10529 typedoc.app = new typedoc.Application()
10530})(typedoc || (typedoc = {}))
10456})(typedoc || (typedoc = {})),
10457(function (typedoc) {
10458 const Toggle = (function (_super) {
10459 function Toggle (options) {10460 const _this = _super.call(this, options) || this
10461 return (
10462 (_this.className = _this.$el.attr('data-toggle') || ''),
10454 })(Backbone.View)
10455 typedoc.registerComponent(Signature, '.tsd-signatures')
10456})(typedoc || (typedoc = {})),
10457(function (typedoc) {10458 const Toggle = (function (_super) {
10459 function Toggle (options) {
10460 const _this = _super.call(this, options) || this
10386 )
10387 })()
10388 const Signature = (function (_super) {
10389 function Signature (options) {10390 const _this = _super.call(this, options) || this
10391 return (
10392 (_this.groups = []),
10364})(typedoc || (typedoc = {})),
10365(function (typedoc) {
10366 const SignatureGroup = (function () {
10367 function SignatureGroup ($signature, $description) {10368 (this.$signature = $signature), (this.$description = $description)
10369 }
10370 return (
Two variables can have the same name if they're declared in different scopes.
In the example below, the parameter x
is said to "shadow" the variable x
declared above it.
The outer x
can no longer be accessed inside the sum
function.
const x = 1
function add(x, y) {
return x + y
}
While shadowing does not cause any problems most of the time, it does make the code harder to read and understand. We highly recommend against shadowing. However, if you want to shadow some variable name and don't want DeepSource to flag it, add a skipcq comment alongside an explanation:
const x = 1
function add(x, y) { // skipcq: JS-0123 - `x` can be safely shadowed
return x + y
}
If you want to disable this issue project-wide, you can add it to the list of disabled issues in the project dashboard.
const file = "data.txt"
function readFile(file) {
// The parameter `file` shadows the toplevel variable `file`.
if (fs.existsSync(file)) {
return fs.readFileSync(file)
}
return null
}
// Prefer variable names that are distinct and convey as much
// meaning as possible.
const dataFile = "data.txt"
function readFile(filePath) {
if (fs.existsSync(filePath)) {
return fs.readFileSync(filePath)
}
return null
}
Alternatively:
const file = "data.txt"
function readFile(file) { // skipcq: JS-0123 - Shadowing is safe here
// ...
}