Title: Bug: WebGL tex(Sub)Image2D optionals · Issue #14305 · microsoft/TypeScript · GitHub
Open Graph Title: Bug: WebGL tex(Sub)Image2D optionals · Issue #14305 · microsoft/TypeScript
X Title: Bug: WebGL tex(Sub)Image2D optionals · Issue #14305 · microsoft/TypeScript
Description: TypeScript Version: 2.2.1 (and previous) Code window.onload = () => { const canvas: HTMLCanvasElement = document.createElement("canvas") as HTMLCanvasElement; const gl: WebGLRenderingContext = canvas.getContext("webgl", { antialias: fals...
Open Graph Description: TypeScript Version: 2.2.1 (and previous) Code window.onload = () => { const canvas: HTMLCanvasElement = document.createElement("canvas") as HTMLCanvasElement; const gl: WebGLRenderingContext = canv...
X Description: TypeScript Version: 2.2.1 (and previous) Code window.onload = () => { const canvas: HTMLCanvasElement = document.createElement("canvas") as HTMLCanvasElement; const gl: WebGLRenderingC...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/14305
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bug: WebGL tex(Sub)Image2D optionals","articleBody":"**TypeScript Version:** 2.2.1 (and previous)\r\n\r\n### Code\r\n\r\n```ts\r\nwindow.onload = () => {\r\n const canvas: HTMLCanvasElement = document.createElement(\"canvas\") as HTMLCanvasElement;\r\n const gl: WebGLRenderingContext = canvas.getContext(\"webgl\", { antialias: false} ) as WebGLRenderingContext;\r\n const tex = gl.createTexture();\r\n gl.bindTexture(gl.TEXTURE_2D, tex);\r\n\r\n/*A1*/ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 32, 32, 0, gl.RGBA, gl.UNSIGNED_BYTE);\r\n/*A2*/ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 32, 32, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\r\n/*A3*/ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE);\r\n\r\n/*B1*/ gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 16, 16, gl.RGBA, gl.UNSIGNED_BYTE);\r\n/*B2*/ gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 16, 16, gl.RGBA, gl.UNSIGNED_BYTE, null);\r\n/*B3*/ gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE);\r\n};\r\n```\r\n\r\n```json\r\nFor cases A2 and B2, only:\r\n{ \"compilerOptions\": { \"strictNullChecks\": true } }\r\n```\r\n\r\n### Expected behavior:\r\n\r\n**A1** should **fail** and raise something like `Valid arities are: [6, 9], but 8 arguments provided.`\r\n**A2** should **pass**, in order to create an empty texture and modify the content later.\r\n**A3** should **fail**, because no source (`ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement`) was provided.\r\n\r\n**B1** should **fail** and raise something like `Valid arities are: [7, 9], but 8 arguments provided.`\r\n**B2** should **pass**, eventually WebGL will return `INVALID_VALUE` for the missing pixels.\r\n**B3** should **fail**, because no source (`ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement`) was provided.\r\n\r\n### Actual behavior:\r\n\r\n**A1** will **pass** tsc, but resulting code fails in browser (Tested with Chrome and Firefox, so far).\r\n**A2** will **fail** tsc, expecting `ArrayBufferView | undefined`.\r\n**A3** will **pass** tsc, but resulting code fails in browser (Tested with Chrome and Firefox, so far).\r\n\r\n**B1** will **pass** tsc, but resulting code fails in browser (Tested with Chrome and Firefox, so far).\r\n**B2** will **fail** tsc, expecting `ArrayBufferView | undefined`.\r\n**B3** will **pass** tsc, but resulting code fails in browser (Tested with Chrome and Firefox, so far).","author":{"url":"https://github.com/nkemnitz","@type":"Person","name":"nkemnitz"},"datePublished":"2017-02-25T01:06:57Z","url":"https://github.com/microsoft/TypeScript/issues/14305"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b97e89a1-7308-a05c-f2bf-08eda8812f21 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 96A2:2454CC:34EB771:4327EE9:6B01E297 |
| html-safe-nonce | 236c1ab95addbf50d2f93625f60a484c1c08a338993760578f9ada13f453908d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NkEyOjI0NTRDQzozNEVCNzcxOjQzMjdFRTk6NkIwMUUyOTciLCJ2aXNpdG9yX2lkIjoiNjg1MTA1NDU4Nzk0MDU2MTU1OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 516bd0cb7468f01c4cc805803ef8dba71f0e33e9cedc0787ab90eaa74e451ef3 |
| hovercard-subject-tag | issue:210197126 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/14305/issue_layout |
| twitter:image | https://opengraph.githubassets.com/10fe0eed83cc9991b612c09d12aeab602cb9cec891a3360e85ffdcc7937f99a0/microsoft/TypeScript/issues/14305 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/10fe0eed83cc9991b612c09d12aeab602cb9cec891a3360e85ffdcc7937f99a0/microsoft/TypeScript/issues/14305 |
| og:image:alt | TypeScript Version: 2.2.1 (and previous) Code window.onload = () => { const canvas: HTMLCanvasElement = document.createElement("canvas") as HTMLCanvasElement; const gl: WebGLRenderingContext = canv... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nkemnitz |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width