C
C
copal2016-02-23 19:54:38
typescript
copal, 2016-02-23 19:54:38

How to set the type of an object in TypeScript?

I once met, but now I can’t recreate and I don’t remember the name.
You need to set the type for an empty object. Like this -
var object: ...string, Type... = {};
That is, to check for a string as a key and a type as a value. How to do this?
those are not tuples...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ruslan Lopatin, 2016-02-23
@copal

var object: {[key: string]: Type} = {};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question