Answer the question
In order to leave comments, you need to log in
Declaration of variables and properties, types in Typescript. What is the correct approach?
Actually the situation is this:
There is a code:
export default class Cookies {
public type: string;
public model: string;
public status: string;
getStatus(t: string) : string {
console.log(t + ' : ' + this.status);
}
}
interface cooking {
public type: string;
public model: string;
public status: string;
getStatus(t: string) : string;
}
class Cookies implement cooking ...
declare namespace cooking {
export interface cooking {
public type: string;
public model: string;
public status: string;
getStatus(t: string) : string;
}
}
Answer the question
In order to leave comments, you need to log in
In this case, there is no need to describe anything separately - everything is described in the code. *.d.ts are needed only if either is written in JS, but it must be included from TS.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question