Skip to content

exporting object and importing object property declared with jsdoc @enum leads to 'declared but its value is never read'  #35348

Closed
@gaurav5430

Description

@gaurav5430

TS Template added by @mjbvz

TypeScript Version: 3.8.0-dev.20191125

Search Terms

  • jsdoc
  • enum
  • unused

Original report below


repo

  1. create a file and export a variable with jsdoc enum annotation
    constants.js
/**
 * @enum {string}
 */
const testString = {
  one: "1",
  two: "2"
};

export { testString };
  1. import the variable using destructuring in another file and console.log it.
import { testString } from "./constants"; 
console.log(testString);

The above code leads to:
'testString' is declared but its value is never read.

The below works fine:
remove the @enum annotation.
OR
export the variable directly and not through an object
export const testString = { ... }

VS Code version: Code 1.38.1 (b37e54c98e1a74ba89e03073e5a3761284e3ffb0, 2019-09-11T13:31:32.854Z)
OS version: Darwin x64 18.7.0

System Info
Item Value
CPUs Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) 2, 2, 2
Memory (System) 16.00GB (0.89GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (6)
Extension Author (truncated) Version
vscode-eslint dba 1.9.1
gitlens eam 10.2.0
prettier-vscode esb 3.9.0
git-graph mhu 1.18.0
debugger-for-chrome msj 4.12.1
react-proptypes-intellisense OfH 1.0.3

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions