GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — TS reporting a non-existing error with Generic Interfaces extension · Issue #28315 · microsoft/TypeScript Closed Labels QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code DescriptionHello everybody! I was trying to build a queue system class to be extended with other classes. { "<identifier>": [ { Function }, { Function }, ... ] } or { "<indentifier>": [ { string } ] } This because I'm going to use two classes (ReplyManager and OperationManager) to extend the queue. These two classes have a different parameter of the array. Therefore I thought to to the model to describe these structures. I came out with this reasoning: interface QueueObject<T> { // @ts-ignore - Hashable is a string or number yet. ( This might be another bug ) [key: Hashable]: T[] } The QueueObject is the base object that will bind the two classes which will extend Queue. interface OperationDescriptior { command: string } interface ReplyDescriptor { action: Function, previousData?: any } These are the descriptors of the content of the arrays, one per class. export type Reply = QueueObject<ReplyDescriptor>; export type Operation = QueueObject<OperationDescriptior>; export type QueueExtendableObject = Reply | Operation; export type Hashable = number | string; In the end we have class QueueManager<T extends QueueExtendableObject> { private _queue : T = <T>{} }; I try to populate the queue object and everything goes fine, but in ReplyManager I have the following method: execute(id: Hashable, data: ReplyData = {}) { let next: Reply = this.get(id); let callback: Function = next.action; data.previousData = next.previousData || undefined; let result = callback(data); // ... } and since I have access to the QueueManager, I can use Code: protected get(id: Hashable): T { return this._queue[id] && this._queue[id].length ? this._queue[id][0] : { action: () => { } }; } Return type: I mean, it makes sense, that's what I wanted! But there is a problem: in execute,
I tried to execute a sample code I wrote to put these class at work and if I log That's why I think this may be a bug. This is the form. TypeScript Version: 3.1.3 Search Terms: "property does not exist in interface", "non existing error" Expected behavior: No alert. Actual behavior: The same error applied on two properties: Thank you. Activity
MetadataMetadataAssigneesLabelsQuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |