<p dir="auto">It's very important that declaring a class field with <code class="notranslate">declare x</code> does <em>not</em> emit a real field.</p>
<p dir="auto">See this example (<a href="https://www.typescriptlang.org/play?useDefineForClassFields=true&amp;target=99&amp;isolatedModules=true&amp;ts=4.4.4#code/KYDwDg9gTgLgBAYwDYEMDOa4DEITgbwFgAoOMuEALjgDsBXAWwCNgoBuE8xCGtGKOghjQAFFVqMWUAJQFOXcjAAWASzQA6EHAC8FDqXIBfEseIlQkWIlQY4AIRRQ4oGMBoATTDjxEDZd8DIjsAU1ACMAEwAzPpcCDx8AkKisr4K5Gh0YKwikVHSsUYmQA" rel="nofollow">playground link</a>):</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export class Foo {
    x: number;
    constructor(x: number) {
        this.x = x;
    }
}

export class Bar extends Foo {
    declare x: 123;
    constructor() {
        super(123);
    }
}"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-k">class</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-c1">x</span>: <span class="pl-smi">number</span><span class="pl-kos">;</span>
    <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-s1">x</span>: <span class="pl-smi">number</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">x</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-k">export</span> <span class="pl-k">class</span> <span class="pl-smi">Bar</span> <span class="pl-k">extends</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-k">declare</span> <span class="pl-c1">x</span>: <span class="pl-c1">123</span><span class="pl-kos">;</span>
    <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-smi">super</span><span class="pl-kos">(</span><span class="pl-c1">123</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Correctly compiled by TSC:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export class Foo {
    x;
    constructor(x) {
        this.x = x;
    }
}
export class Bar extends Foo {
    constructor() {
        super(123);
    }
}"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-k">class</span> <span class="pl-v">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-c1">x</span><span class="pl-kos">;</span>
    <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-s1">x</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">x</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span>
<span class="pl-k">export</span> <span class="pl-k">class</span> <span class="pl-v">Bar</span> <span class="pl-k">extends</span> <span class="pl-v">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-smi">super</span><span class="pl-kos">(</span><span class="pl-c1">123</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Incorrectly emitted by Deno:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="    class Foo {
        x;
        constructor(x){
            this.x = x;
        }
    }
    class Bar extends Foo {
        x; // &lt;-- should not be here
        constructor(){
            super(123);
        }
    }"><pre class="notranslate">    <span class="pl-k">class</span> <span class="pl-v">Foo</span> <span class="pl-kos">{</span>
        <span class="pl-c1">x</span><span class="pl-kos">;</span>
        <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-s1">x</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
            <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">x</span><span class="pl-kos">;</span>
        <span class="pl-kos">}</span>
    <span class="pl-kos">}</span>
    <span class="pl-k">class</span> <span class="pl-v">Bar</span> <span class="pl-k">extends</span> <span class="pl-v">Foo</span> <span class="pl-kos">{</span>
        <span class="pl-c1">x</span><span class="pl-kos">;</span> <span class="pl-c">// &lt;-- should not be here</span>
        <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
            <span class="pl-smi">super</span><span class="pl-kos">(</span><span class="pl-c1">123</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
        <span class="pl-kos">}</span>
    <span class="pl-kos">}</span></pre></div>
<p dir="auto">Now Foo and Bar have two completely different fields named <code class="notranslate">x</code>.  The <code class="notranslate">declare</code> keyword is supposed to give you a way around this.</p>
<p dir="auto">In the code sample below, the parent Example class sets thing to the first arg of the constructor. For the child class, the constructor knows that the super constructor sets thing to the first arg, so it doesn't assign it directly. If I try declaring the type for the thing property on the Example2 class, I get warnings for deno-ts 2564 and 2612. As shown in the screenshot below, one of the recommended fixes is "Prefix with 'declare'" and it resolves the issue.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/3241653/120904922-6e78fb00-c614-11eb-8087-9b25835e0dff.png"><img src="https://user-images.githubusercontent.com/3241653/120904922-6e78fb00-c614-11eb-8087-9b25835e0dff.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">If I try using the declared property, it doesn't show any warnings or errors.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/3241653/120904973-bbf56800-c614-11eb-9596-153b8c0fd216.png"><img src="https://user-images.githubusercontent.com/3241653/120904973-bbf56800-c614-11eb-9596-153b8c0fd216.png" alt="image" style="max-width: 100%;"></a></p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import { assertEquals } from &quot;https://deno.land/std@0.97.0/testing/asserts.ts&quot;;

interface Thing {
  x: number;
  y: number;
}

interface Thing2 extends Thing {
  z: number;
}

class Example {
  thing: Thing;

  constructor(thing: Thing) {
    this.thing = thing;
  }
}

Deno.test(&quot;example 1&quot;, () =&gt; {
  const example = new Example({x:2, y:3});
  const {x, y} = example.thing;
  assertEquals(x * y, 6);
})

class Example2 extends Example {
  declare thing: Thing2;
  
  constructor(thing: Thing2) {
    super(thing);
  }
}

Deno.test(&quot;example 2&quot;, () =&gt; {
  const example = new Example2({x:2, y:3, z:4});
  const {x, y, z} = example.thing;
  assertEquals(x * y * z, 24);
})"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-s1">assertEquals</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">"https://deno.land/std@0.97.0/testing/asserts.ts"</span><span class="pl-kos">;</span>

<span class="pl-k">interface</span> <span class="pl-smi">Thing</span> <span class="pl-kos">{</span>
  <span class="pl-c1">x</span>: <span class="pl-smi">number</span><span class="pl-kos">;</span>
  <span class="pl-c1">y</span>: <span class="pl-smi">number</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">interface</span> <span class="pl-smi">Thing2</span> <span class="pl-k">extends</span> <span class="pl-smi">Thing</span> <span class="pl-kos">{</span>
  <span class="pl-c1">z</span>: <span class="pl-smi">number</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">class</span> <span class="pl-smi">Example</span> <span class="pl-kos">{</span>
  <span class="pl-c1">thing</span>: <span class="pl-smi">Thing</span><span class="pl-kos">;</span>

  <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-s1">thing</span>: <span class="pl-smi">Thing</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">thing</span> <span class="pl-c1">=</span> <span class="pl-s1">thing</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-smi">Deno</span><span class="pl-kos">.</span><span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-s">"example 1"</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-k">const</span> <span class="pl-s1">example</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-smi">Example</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">x</span>:<span class="pl-c1">2</span><span class="pl-kos">,</span> <span class="pl-c1">y</span>:<span class="pl-c1">3</span><span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">const</span> <span class="pl-kos">{</span>x<span class="pl-kos">,</span> y<span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-s1">example</span><span class="pl-kos">.</span><span class="pl-c1">thing</span><span class="pl-kos">;</span>
  <span class="pl-en">assertEquals</span><span class="pl-kos">(</span><span class="pl-s1">x</span> <span class="pl-c1">*</span> <span class="pl-s1">y</span><span class="pl-kos">,</span> <span class="pl-c1">6</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span>

<span class="pl-k">class</span> <span class="pl-smi">Example2</span> <span class="pl-k">extends</span> <span class="pl-smi">Example</span> <span class="pl-kos">{</span>
  <span class="pl-k">declare</span> <span class="pl-c1">thing</span>: <span class="pl-smi">Thing2</span><span class="pl-kos">;</span>
  
  <span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-s1">thing</span>: <span class="pl-smi">Thing2</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-smi">super</span><span class="pl-kos">(</span><span class="pl-s1">thing</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-smi">Deno</span><span class="pl-kos">.</span><span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-s">"example 2"</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-k">const</span> <span class="pl-s1">example</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-smi">Example2</span><span class="pl-kos">(</span><span class="pl-kos">{</span><span class="pl-c1">x</span>:<span class="pl-c1">2</span><span class="pl-kos">,</span> <span class="pl-c1">y</span>:<span class="pl-c1">3</span><span class="pl-kos">,</span> <span class="pl-c1">z</span>:<span class="pl-c1">4</span><span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">const</span> <span class="pl-kos">{</span>x<span class="pl-kos">,</span> y<span class="pl-kos">,</span> z<span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-s1">example</span><span class="pl-kos">.</span><span class="pl-c1">thing</span><span class="pl-kos">;</span>
  <span class="pl-en">assertEquals</span><span class="pl-kos">(</span><span class="pl-s1">x</span> <span class="pl-c1">*</span> <span class="pl-s1">y</span> <span class="pl-c1">*</span> <span class="pl-s1">z</span><span class="pl-kos">,</span> <span class="pl-c1">24</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">If I run the above deno tests, the results change after using --no-check. In the example below, the first 2 runs without --no-check are successful. As soon as I run with --no-check, the example 2 test case fails with an error saying  "TypeError: Cannot destructure property 'x' of 'example.thing' as it is undefined.". The following 2 runs without --no-check now fail with the same error. The only way to get the error go away without --no-check is to edit the file, but if I run deno test with --no-check again, it ends up causing the issue to happen again. I believe the correct behavior would be for the tests to pass with or without the --no-check flag.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ deno test example_test.ts
Check file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
Check file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
running 2 tests from file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
test example 1 ... ok (3ms)
test example 2 ... ok (1ms)

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (631ms)

$ deno test example_test.ts
Check file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
Check file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
running 2 tests from file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
test example 1 ... ok (1ms)
test example 2 ... ok (2ms)

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (625ms)

$ deno test --no-check example_test.ts
running 2 tests from file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
test example 1 ... ok (3ms)
test example 2 ... FAILED (1ms)

failures:

example 2
TypeError: Cannot destructure property 'x' of 'example.thing' as it is undefined.
    at file:///home/kyle/Projects/deno/oauth2_server/example_test.ts:36:10
    at asyncOpSanitizer (deno:runtime/js/40_testing.js:21:15)
    at resourceSanitizer (deno:runtime/js/40_testing.js:58:13)
    at exitSanitizer (deno:runtime/js/40_testing.js:85:15)
    at runTest (deno:runtime/js/40_testing.js:199:13)
    at Object.runTests (deno:runtime/js/40_testing.js:244:13)
    at async file:///home/kyle/Projects/deno/oauth2_server/$deno$test.js:1:1

failures:

        example 2

test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out (41ms)

$ deno test example_test.ts
Check file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
Check file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
running 2 tests from file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
test example 1 ... ok (1ms)
test example 2 ... FAILED (2ms)

failures:

example 2
TypeError: Cannot destructure property 'x' of 'example.thing' as it is undefined.
    at file:///home/kyle/Projects/deno/oauth2_server/example_test.ts:36:10
    at asyncOpSanitizer (deno:runtime/js/40_testing.js:21:15)
    at resourceSanitizer (deno:runtime/js/40_testing.js:58:13)
    at exitSanitizer (deno:runtime/js/40_testing.js:85:15)
    at runTest (deno:runtime/js/40_testing.js:199:13)
    at Object.runTests (deno:runtime/js/40_testing.js:244:13)
    at async file:///home/kyle/Projects/deno/oauth2_server/$deno$test.js:1:1

failures:

        example 2

test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out (617ms)
$ deno test example_test.ts
Check file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
Check file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
running 2 tests from file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
test example 1 ... ok (3ms)
test example 2 ... FAILED (1ms)

failures:

example 2
TypeError: Cannot destructure property 'x' of 'example.thing' as it is undefined.
    at file:///home/kyle/Projects/deno/oauth2_server/example_test.ts:36:10
    at asyncOpSanitizer (deno:runtime/js/40_testing.js:21:15)
    at resourceSanitizer (deno:runtime/js/40_testing.js:58:13)
    at exitSanitizer (deno:runtime/js/40_testing.js:85:15)
    at runTest (deno:runtime/js/40_testing.js:199:13)
    at Object.runTests (deno:runtime/js/40_testing.js:244:13)
    at async file:///home/kyle/Projects/deno/oauth2_server/$deno$test.js:1:1

failures:

        example 2

test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out (641ms)"><pre class="notranslate"><code class="notranslate">$ deno test example_test.ts
Check file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
Check file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
running 2 tests from file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
test example 1 ... ok (3ms)
test example 2 ... ok (1ms)

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (631ms)

$ deno test example_test.ts
Check file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
Check file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
running 2 tests from file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
test example 1 ... ok (1ms)
test example 2 ... ok (2ms)

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (625ms)

$ deno test --no-check example_test.ts
running 2 tests from file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
test example 1 ... ok (3ms)
test example 2 ... FAILED (1ms)

failures:

example 2
TypeError: Cannot destructure property 'x' of 'example.thing' as it is undefined.
    at file:///home/kyle/Projects/deno/oauth2_server/example_test.ts:36:10
    at asyncOpSanitizer (deno:runtime/js/40_testing.js:21:15)
    at resourceSanitizer (deno:runtime/js/40_testing.js:58:13)
    at exitSanitizer (deno:runtime/js/40_testing.js:85:15)
    at runTest (deno:runtime/js/40_testing.js:199:13)
    at Object.runTests (deno:runtime/js/40_testing.js:244:13)
    at async file:///home/kyle/Projects/deno/oauth2_server/$deno$test.js:1:1

failures:

        example 2

test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out (41ms)

$ deno test example_test.ts
Check file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
Check file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
running 2 tests from file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
test example 1 ... ok (1ms)
test example 2 ... FAILED (2ms)

failures:

example 2
TypeError: Cannot destructure property 'x' of 'example.thing' as it is undefined.
    at file:///home/kyle/Projects/deno/oauth2_server/example_test.ts:36:10
    at asyncOpSanitizer (deno:runtime/js/40_testing.js:21:15)
    at resourceSanitizer (deno:runtime/js/40_testing.js:58:13)
    at exitSanitizer (deno:runtime/js/40_testing.js:85:15)
    at runTest (deno:runtime/js/40_testing.js:199:13)
    at Object.runTests (deno:runtime/js/40_testing.js:244:13)
    at async file:///home/kyle/Projects/deno/oauth2_server/$deno$test.js:1:1

failures:

        example 2

test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out (617ms)
$ deno test example_test.ts
Check file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
Check file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
running 2 tests from file:///home/kyle/Projects/deno/oauth2_server/example_test.ts
test example 1 ... ok (3ms)
test example 2 ... FAILED (1ms)

failures:

example 2
TypeError: Cannot destructure property 'x' of 'example.thing' as it is undefined.
    at file:///home/kyle/Projects/deno/oauth2_server/example_test.ts:36:10
    at asyncOpSanitizer (deno:runtime/js/40_testing.js:21:15)
    at resourceSanitizer (deno:runtime/js/40_testing.js:58:13)
    at exitSanitizer (deno:runtime/js/40_testing.js:85:15)
    at runTest (deno:runtime/js/40_testing.js:199:13)
    at Object.runTests (deno:runtime/js/40_testing.js:244:13)
    at async file:///home/kyle/Projects/deno/oauth2_server/$deno$test.js:1:1

failures:

        example 2

test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out (641ms)
</code></pre></div>
<p dir="auto">I'm using the latest version of deno.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="deno 1.10.3 (release, x86_64-unknown-linux-gnu)
v8 9.1.269.27
typescript 4.2.2"><pre class="notranslate"><code class="notranslate">deno 1.10.3 (release, x86_64-unknown-linux-gnu)
v8 9.1.269.27
typescript 4.2.2
</code></pre></div>