type-definition Questions
3
Assuming you have the following code inside a ES6 class (documentation):
/**
* @typedef Test~options
* @type {object.<string>}
* @property {array} elements - An array containing elements
...
Apoenzyme asked 20/4, 2016 at 8:24
1
Solved
I have interface with list of optional properties.
export interface OptionalIds {
entityA_Id?: number;
entityB_Id?: number;
entityC_Id?: number;
}
And I have a requirement that EXACTLY one of t...
Draughts asked 3/10, 2022 at 10:42
2
Solved
When writing type for cb:
const fn1 = (
cb: (...args: [...args: any[], fn2: () => string, fn3: () => string]) => any,
...args: any[]
) => {
const fn2 = () => 'fn2'
const fn3 = ()...
Ribbonwood asked 12/3, 2021 at 3:37
2
This is my dictionary:
type Words = 'man' | 'sun' | 'person'
type Dictionary = Record<Words,string>
And Dictionary equals to this type:
type Dictionary = {
man: string;
sun: string;
perso...
Dday asked 21/11, 2021 at 3:28
4
Solved
Type alias:
type A = string
Type definition:
type A string
What is the difference between them? I can't understand from spec
Achromic asked 16/4, 2020 at 10:20
4
Solved
I know how to extend a TypeScript interface, but what I'm asking here is how to override a particular key in an interface. For example, say I have a simple interface A:
interface A {
foo: string;...
Devise asked 5/3, 2017 at 14:43
1
Solved
I'm writing a type definition file (index.d.ts) for a jQuery library that doesn't come with a type definition.
The methods of that library repeatedly accept parameters of the same multi-type (strin...
Sherborn asked 17/10, 2020 at 13:57
1
Solved
I'm working on an Angular 9 project. I'd like to use a ResizeObserver, but since this type is currently missing from TypeScript's lib.dom.d.ts (issue), I tried to add Jason Strothmann's ResizeObser...
Tabes asked 13/5, 2020 at 8:53
3
Solved
I'm learning Fortran and I'd like to encapsulate an array and a subroutine in a type. The problem appears to be in the type definition of the self-object.
This is the minimal test case I came up w...
Fairfax asked 6/10, 2018 at 10:46
2
Solved
I am attempting to set up a TypeScript project and get bootstrap 4 working along with Popper, jQuery, and Knockout in Visual Studio Code.
I installed the knockout, jquery and bootstrap type defini...
Diversity asked 26/2, 2019 at 20:7
1
Solved
I put up my own typescript project with the Parcel compiler and got everything running on the built-in server. I implemented pixi.js and wanted to import .png files into my .ts files. But when I tr...
Bedabble asked 26/11, 2019 at 16:50
1
Solved
Is it legal to have fields with the same name across different anonymous unions inside one union?
union Foo
{
union
{
int bar;
};
union
{
int bar;
};
};
This code fails to compile by GC...
Auberge asked 14/11, 2018 at 22:38
6
Solved
I'm trying create type definitions for an existing suite of stateless React components, so I can generate documentation automagically and to improve intellisense in my team's tooling.
An example c...
Hartzell asked 20/6, 2018 at 11:18
2
If I have a TypeScript module saved as my-function.ts as follows :
export function myFunction (param: number): number { return param }
This will be compiled to JavaScript in whichever way and lo...
Rockhampton asked 5/6, 2017 at 8:16
1
Solved
I want to write a type definition for storybook-router. It needn't be that accurate, since this is a minor development tool (i.e. anys are acceptable), but I can't even seem to get that to work.
W...
Erinnerinna asked 20/12, 2017 at 10:0
2
Solved
Heyho,
I want to use some javascript libraries in my typescript code for which there are no typings in npm. So I wrote the typings myself and put them in a definitions directory in my source tree....
Brammer asked 4/8, 2017 at 12:58
1
© 2022 - 2024 — McMap. All rights reserved.