Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Commit

Permalink
Fix/ts3.1.1 compatibility (#264)
Browse files Browse the repository at this point in the history
* fixing action to send requests

* Adds compatibility to the older Typescript 3.1.1

Co-authored-by: carolinegoncalveszup <[email protected]>
  • Loading branch information
Tiagoperes and carolinegoncalveszup authored Oct 6, 2020
1 parent 29ae52b commit b8d67ef
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/beagle-tree/iteration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

import { Iterator } from 'types'
import { BeagleUIElement } from './types'

type Iteratee<ItemType, ReturnType> = (item: ItemType, index: number) => ReturnType
Expand Down
1 change: 1 addition & 0 deletions src/legacy/beagle-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import { IdentifiableBeagleUIElement } from 'beagle-tree/types'
import { LoadParams, BeagleView, UpdateWithTreeParams } from 'beagle-view/types'
import { ViewContentManager } from 'service/view-content-manager/types'
import { Omit } from 'types'

/**
* @deprecated since v1.2. Will de deleted in v2.0. Use `ViewContentManager` instead.
Expand Down
24 changes: 24 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,32 @@
* limitations under the License.
*/

/* compatibility mode: older versions of Typescript that must be supported by Beagle (>= 3.1.1)
don't have "Omit" natively */
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>

/* The following 4 types have been copied from the original ES6 module definition and slightly
altered. This must be done because we must target ES5 in our build, which doesn't have support to
iterators. It's true that iterators won't work in ES5 environments, but we don't want to limit
Beagle for people using ES6 or later. */
export interface IteratorYieldResult<TYield> {
done?: false,
value: TYield,
}

export interface IteratorReturnResult {
done: true,
value: any,
}

export type IteratorResult<T> = IteratorYieldResult<T> | IteratorReturnResult

export interface Iterator<T> {
next(...args: []): IteratorResult<T>,
return?(value?: any): IteratorResult<T>,
throw?(e?: any): IteratorResult<T>,
}

// todo: legacy code, remove with v2.0
import { ClickEvent as CE, ScreenEvent as SE } from 'service/beagle-service/types'
import { IdentifiableBeagleUIElement as IBE, BeagleUIElement as BE } from 'beagle-tree/types'
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"metadata/*": ["metadata/*"],
"operation/*": ["operation/*"],
"service/*": ["service/*"],
"utils/*": ["utils/*"]
"utils/*": ["utils/*"],
"types/*": ["types/*"]
}
},
"include": [
Expand Down

0 comments on commit b8d67ef

Please sign in to comment.