Exclude type from typescript array of typesTypescript: Remove entries from tuple typeWhat is TypeScript and why would I use it in place of JavaScript?get and set in TypeScriptAre strongly-typed functions as parameters possible in TypeScript?TypeScript Converting a String to a numberTypescript: Interfaces vs TypesWhy isn't the type argument inferred as a union type?In Typescript how do you get an element type from an array type, when the array contains different element types?Creating a Factory with type checked parameters in Typescript 3.0Use of Conditional types and mapped types with array reduce methodHow to write omit function with proper types in typescript

Sound waves in different octaves

Difference between shutdown options

What in this world is she trying to say?

Limit max CPU usage SQL SERVER with WSRM

Can I say "fingers" when referring to toes?

Giving feedback to someone without sounding prejudiced

"Oh no!" in Latin

I'm just a whisper. Who am I?

Grepping string, but include all non-blank lines following each grep match

How to write Quadratic equation with negative coefficient

Why didn’t Eve recognize the little cockroach as a living organism?

Showing mass murder in a kid's book

Isometric embedding of a genus g surface

Are Captain Marvel's powers affected by Thanos breaking the Tesseract and claiming the stone?

Mimic lecturing on blackboard, facing audience

Why do Radio Buttons not fill the entire outer circle?

Origin of pigs as a species

How to make money from a browser who sees 5 seconds into the future of any web page?

ContourPlot — How do I color by contour curvature?

Is there a RAID 0 Equivalent for RAM?

Quoting Keynes in a lecture

How would a solely written language work mechanically

What is the smallest number n> 5 so that 5 ^ n ends with "3125"?

Should I assume I have passed probation?



Exclude type from typescript array of types


Typescript: Remove entries from tuple typeWhat is TypeScript and why would I use it in place of JavaScript?get and set in TypeScriptAre strongly-typed functions as parameters possible in TypeScript?TypeScript Converting a String to a numberTypescript: Interfaces vs TypesWhy isn't the type argument inferred as a union type?In Typescript how do you get an element type from an array type, when the array contains different element types?Creating a Factory with type checked parameters in Typescript 3.0Use of Conditional types and mapped types with array reduce methodHow to write omit function with proper types in typescript













3















Suppose i have these types



 /** Types of a function's arguments */
export type ArgumentTypes<F extends Function> = F extends (...args: infer A) => any ? A : never;

export type ExcludeQueryParams<T> = [P in keyof T]: T[P] extends PagingParameters ? never : T[P]


Then i have this code to extract the types of the arguments for a function



function test(query: PagingParameters, as: number, f: string) 
return 1;


type argTypes = ArgumentTypes<typeof test>
type result = ExcludeQueryParams<argTypes>


Above, argTypes will equal [PagingParameters, number, string]



What i am trying to do is extract the PagingParameters type from the array so result is [number, string], however using ExcludeQueryParams the result is [never, number, string].



How can achieve this properly without the final type array containing the never type?










share|improve this question
























  • What are you doing with the ExcludeQueryParams type?

    – Shaun Luttin
    Mar 7 at 3:23






  • 1





    view edit @ShaunLuttin

    – joeblow
    Mar 7 at 3:30











  • Related: Typescript: Remove entries from tuple type

    – CRice
    Mar 7 at 3:36















3















Suppose i have these types



 /** Types of a function's arguments */
export type ArgumentTypes<F extends Function> = F extends (...args: infer A) => any ? A : never;

export type ExcludeQueryParams<T> = [P in keyof T]: T[P] extends PagingParameters ? never : T[P]


Then i have this code to extract the types of the arguments for a function



function test(query: PagingParameters, as: number, f: string) 
return 1;


type argTypes = ArgumentTypes<typeof test>
type result = ExcludeQueryParams<argTypes>


Above, argTypes will equal [PagingParameters, number, string]



What i am trying to do is extract the PagingParameters type from the array so result is [number, string], however using ExcludeQueryParams the result is [never, number, string].



How can achieve this properly without the final type array containing the never type?










share|improve this question
























  • What are you doing with the ExcludeQueryParams type?

    – Shaun Luttin
    Mar 7 at 3:23






  • 1





    view edit @ShaunLuttin

    – joeblow
    Mar 7 at 3:30











  • Related: Typescript: Remove entries from tuple type

    – CRice
    Mar 7 at 3:36













3












3








3


1






Suppose i have these types



 /** Types of a function's arguments */
export type ArgumentTypes<F extends Function> = F extends (...args: infer A) => any ? A : never;

export type ExcludeQueryParams<T> = [P in keyof T]: T[P] extends PagingParameters ? never : T[P]


Then i have this code to extract the types of the arguments for a function



function test(query: PagingParameters, as: number, f: string) 
return 1;


type argTypes = ArgumentTypes<typeof test>
type result = ExcludeQueryParams<argTypes>


Above, argTypes will equal [PagingParameters, number, string]



What i am trying to do is extract the PagingParameters type from the array so result is [number, string], however using ExcludeQueryParams the result is [never, number, string].



How can achieve this properly without the final type array containing the never type?










share|improve this question
















Suppose i have these types



 /** Types of a function's arguments */
export type ArgumentTypes<F extends Function> = F extends (...args: infer A) => any ? A : never;

export type ExcludeQueryParams<T> = [P in keyof T]: T[P] extends PagingParameters ? never : T[P]


Then i have this code to extract the types of the arguments for a function



function test(query: PagingParameters, as: number, f: string) 
return 1;


type argTypes = ArgumentTypes<typeof test>
type result = ExcludeQueryParams<argTypes>


Above, argTypes will equal [PagingParameters, number, string]



What i am trying to do is extract the PagingParameters type from the array so result is [number, string], however using ExcludeQueryParams the result is [never, number, string].



How can achieve this properly without the final type array containing the never type?







typescript






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 3:29







joeblow

















asked Mar 7 at 2:51









joeblowjoeblow

162




162












  • What are you doing with the ExcludeQueryParams type?

    – Shaun Luttin
    Mar 7 at 3:23






  • 1





    view edit @ShaunLuttin

    – joeblow
    Mar 7 at 3:30











  • Related: Typescript: Remove entries from tuple type

    – CRice
    Mar 7 at 3:36

















  • What are you doing with the ExcludeQueryParams type?

    – Shaun Luttin
    Mar 7 at 3:23






  • 1





    view edit @ShaunLuttin

    – joeblow
    Mar 7 at 3:30











  • Related: Typescript: Remove entries from tuple type

    – CRice
    Mar 7 at 3:36
















What are you doing with the ExcludeQueryParams type?

– Shaun Luttin
Mar 7 at 3:23





What are you doing with the ExcludeQueryParams type?

– Shaun Luttin
Mar 7 at 3:23




1




1





view edit @ShaunLuttin

– joeblow
Mar 7 at 3:30





view edit @ShaunLuttin

– joeblow
Mar 7 at 3:30













Related: Typescript: Remove entries from tuple type

– CRice
Mar 7 at 3:36





Related: Typescript: Remove entries from tuple type

– CRice
Mar 7 at 3:36












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55035311%2fexclude-type-from-typescript-array-of-types%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55035311%2fexclude-type-from-typescript-array-of-types%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

Алба-Юлія

Захаров Федір Захарович