-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do this
Milestone
Description
According to this MDN page, "nonce"
is a valid attribute for a <script>
element.
This page says the same about <style>
element.
TypeScript Version: 2.9.0-dev.20180516
Search Terms:
- "nonce" - 2 issues, both irrelevant
- "HTMLScriptElement"
Code
declare var scriptElement: HTMLScriptElement;
declare var styleElement: HTMLStyleElement;
scriptElement.nonce = "someValue";
styleElement.nonce = "someValue";
A fully-functional local example can be created like this (verified on MacOS):
mkdir nonce-test
cd nonce-test/
yarn init -p -y
yarn add typescript@next
touch test.ts
echo 'declare var scriptElement: HTMLScriptElement;' >> test.ts
echo 'declare var styleElement: HTMLStyleElement;' >> test.ts
echo 'scriptElement.nonce = "someValue";' >> test.ts
echo 'styleElement.nonce = "someValue";' >> test.ts
yarn tsc test.ts --target ES6 --noEmit
Expected behavior:
the command
tsc test.ts --target ES6 --noEmit
should complete without errors
Actual behavior:
There are two errors reported:
test.ts:3:15 - error TS2339: Property 'nonce' does not exist on type 'HTMLScriptElement'.
3 scriptElement.nonce = "someValue";
~~~~~
test.ts:4:14 - error TS2339: Property 'nonce' does not exist on type 'HTMLStyleElement'.
4 styleElement.nonce = "someValue";
~~~~~
Related Issues:
Although issue #8955 and pr #8956 are not related to this particular issue, they deal with a very similar problem of having incomplete typings
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do this