lit / lit-element

LEGACY REPO. This repository is for maintenance of the legacy LitElement library. The LitElement base class is now part of the Lit library, which is developed in the lit monorepo.
https://lit-element.polymer-project.org
BSD 3-Clause "New" or "Revised" License
4.49k stars 318 forks source link

[bug] Cannot find name 'ClassDescriptor' (v0.7.0) #428

Closed lacolaco closed 5 years ago

lacolaco commented 5 years ago

Description

When I use decorators of LitElement, TypeScript compiler emits errors.

ERROR in [at-loader] ./node_modules/@polymer/lit-element/lib/decorators.d.ts:37:105
    TS2304: Cannot find name 'ClassDescriptor'.

ERROR in [at-loader] ./node_modules/@polymer/lit-element/lib/decorators.d.ts:43:118
    TS2304: Cannot find name 'ClassElement'.

ERROR in [at-loader] ./node_modules/@polymer/lit-element/lib/decorators.d.ts:48:80
    TS2304: Cannot find name 'ClassElement'.

ERROR in [at-loader] ./node_modules/@polymer/lit-element/lib/decorators.d.ts:53:83
    TS2304: Cannot find name 'ClassElement'.

It looks a bug. env.d.ts is only accessible from LitElement source code. https://github.com/Polymer/lit-element/blob/master/src/env.d.ts

Live Demo

https://stackblitz.com/edit/lit-element-example?file=index.js

https://glitch.com/edit/#!/hello-lit-element?path=index.html:1:0

Steps to Reproduce

  1. Install v0.7.0
  2. Use @property() in TypeScript
  3. Execute tsc

Expected Results

No errors.

Actual Results

Error is thrown

Browsers Affected

Versions

abdonrd commented 5 years ago

Related: https://github.com/Polymer/pwa-starter-kit/issues/316

motss commented 5 years ago

FWIW, there is also another error.

error TS2304: Cannod find name 'Constructor'.