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
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
add a comment |
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
What are you doing with theExcludeQueryParamstype?
– 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
add a comment |
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
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
typescript
edited Mar 7 at 3:29
joeblow
asked Mar 7 at 2:51
joeblowjoeblow
162
162
What are you doing with theExcludeQueryParamstype?
– 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
add a comment |
What are you doing with theExcludeQueryParamstype?
– 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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
What are you doing with the
ExcludeQueryParamstype?– 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