Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix #115: typeof usage on object types#116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
SebastienGllmt wants to merge2 commits intowoutervh-:master
base:master
Choose a base branch
Loading
fromSebastienGllmt:fix-issue-115

Conversation

SebastienGllmt
Copy link

@SebastienGllmtSebastienGllmt commentedNov 13, 2021
edited
Loading

See#115 for the description of the problem and how I got to the solution

This is the final generated code which looks correct 👍

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Status=void0;constassert=require("assert");constindex_1=require("../index");/* https://github.com/woutervh-/typescript-is/issues/115 */exports.Status={enable:'enable',disable:'disable'};describe('is',()=>{describe('Accessing generic member of a type',()=>{it('should return true for the right member',()=>{assert.deepStrictEqual(index_1.is({status:exports.Status.enable},object=>{function_1(object){;if(object!=="enable")return{};elsereturnnull;}function_0(object){;if(typeofobject!=="object"||object===null||Array.isArray(object))return{};{if("status"inobject){varerror=_1(object["status"]);if(error)returnerror;}elsereturn{};}returnnull;}return_0(object);}),true);});it('should return false for the wrong member',()=>{assert.deepStrictEqual(index_1.is({status:exports.Status.disable},object=>{function_1(object){;if(object!=="enable")return{};elsereturnnull;}function_0(object){;if(typeofobject!=="object"||object===null||Array.isArray(object))return{};{if("status"inobject){varerror=_1(object["status"]);if(error)returnerror;}elsereturn{};}returnnull;}return_0(object);}),false);});});});

sgehly reacted with heart emoji
@SebastienGllmtSebastienGllmt changed the titleFix #115: indexing type with genericFix #115: typeof usage on object typesNov 15, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@SebastienGllmt

[8]ページ先頭

©2009-2025 Movatter.jp