Typescript: TS3.0-RC - VRLayer left/rightBounds type.

Created on 28 Jul 2018  路  11Comments  路  Source: microsoft/TypeScript

TypeScript Version: 3.0.0-rc
VRLayer type described in 3.0rc's _lib.dom.d.ts_ conflicts with the one in _@types/webvr-api_. The latter is a devDependency for the widely used _@types/three_.

VRLayer in lib.dom.d.ts:

interface VRLayer {
    leftBounds?: number[] | Float32Array | null;
    rightBounds?: number[] | Float32Array | null;
    source?: HTMLCanvasElement | null;
}

VRLayer in @types/webvr_api/index.d.ts:

interface VRLayer {
    leftBounds?: number[] | null;
    rightBounds?: number[] | null;
    source?: HTMLCanvasElement | null;
}

Looking at the specs, including Float32Array among the piped types seems unnecessary/wrong to me.

Bug lib.d.ts Fixed

Most helpful comment

@kitsonk that pr still seems to include Float32Array in the union https://github.com/Microsoft/TSJS-lib-generator/pull/546/files#diff-a97a9d0dbf71ec2f96be57f7fb9f70c9R1523

So we would still be seeing the same issues we're having right now with the webvr typings, no?

I'd still appreciate some input on how best to reconcile this situation perhaps from @mhegazy or @RyanCavanaugh .

There are three situations that need to be handled by the DT webvr-api typings:

  • Use with TS before it had any webvr typings built in.
  • Use with later 2.x TS versions which had webvr typings.
  • Use with the 3.x TS versions with this changed definition.

Is there any way to satisfy all three? Or should we do a major version bump of the webvr typings and support TS 3 onwards only in the next major version? I've not done a major version bump inside DT before, anything to be aware of if that's our preferred choice here? Is there still a possibility TS 3.x will revert to how it was in 2? @mhegazy and @kitsonk both seem to suggest this may be happening though I'm yet to see a code change that does it.

All 11 comments

This all came about due to an issue discussed in Microsoft/TSJS-lib-generator#419 where some browsers adopted earlier versions of the spec which required Float32Array.

Is there a workaround for this issue in the meantime? Thanks!

EDIT: Worked around this issue by adding a new type roots folder, with webvr-api/index.d.ts and the Float32Array definition. Will subsequently drop this folder and the erroneous definition.

@mhegazy perhaps I'm missing it but I don't see any changes to VRLayer in the pr you mentioned https://github.com/Microsoft/TypeScript/pull/25944 , are you sure it fixes it?

@RyanCavanaugh

It looks like Microsoft/TSJS-lib-generator#546 hasn't been merged.

@kitsonk that pr still seems to include Float32Array in the union https://github.com/Microsoft/TSJS-lib-generator/pull/546/files#diff-a97a9d0dbf71ec2f96be57f7fb9f70c9R1523

So we would still be seeing the same issues we're having right now with the webvr typings, no?

I'd still appreciate some input on how best to reconcile this situation perhaps from @mhegazy or @RyanCavanaugh .

There are three situations that need to be handled by the DT webvr-api typings:

  • Use with TS before it had any webvr typings built in.
  • Use with later 2.x TS versions which had webvr typings.
  • Use with the 3.x TS versions with this changed definition.

Is there any way to satisfy all three? Or should we do a major version bump of the webvr typings and support TS 3 onwards only in the next major version? I've not done a major version bump inside DT before, anything to be aware of if that's our preferred choice here? Is there still a possibility TS 3.x will revert to how it was in 2? @mhegazy and @kitsonk both seem to suggest this may be happening though I'm yet to see a code change that does it.

@mhegazy, perhaps we should re-open this issue? We still have the exact issue described. Do you remember what was the motivation for closing the issue?

Why is this issue closed when it hasn't been resolved?

Bump. Still running into this issue with 3.1.1.

Bump. Still running into this issue with 3.1.1.

Updating the dependencies to the following versions, everything runs smoothly:

"devDependencies":{
    "typescript": "3.1.1",
    "@types/three": "^0.92.23",
    /*"@types/webvr-api": "^0.0.34" removed */
    /* [...] others */
}

Given that

Was this page helpful?
0 / 5 - 0 ratings