Skip to content

Commit

Permalink
fix: use Record<string, any> instead of {}
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jan 20, 2021
1 parent 6d559af commit 6b32481
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions lib/decoration-management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export default class DecorationManagement {
* highlight-outine decorations at a given
* row
*/
decorationsByTypeThenRows(): {} {
decorationsByTypeThenRows(): Record<string, any> {
if (this.decorationsByTypeThenRowsCache != null) {
return this.decorationsByTypeThenRowsCache
}
Expand Down Expand Up @@ -481,7 +481,7 @@ export default class DecorationManagement {
* change object
* @access private
*/
emitRangeChanges(type: string, range: {}, screenDelta) {
emitRangeChanges(type: string, range: Record<string, any>, screenDelta) {
const startScreenRow = range.start.row
const endScreenRow = range.end.row
const lastRenderedScreenRow = this.minimap.getLastVisibleScreenRow()
Expand Down
10 changes: 5 additions & 5 deletions lib/decoration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class Decoration {
* @param {string} type the decoration type to match
* @return {boolean} whether the decoration properties match the type
*/
static isType(decorationProperties: {}, type: string): boolean {
static isType(decorationProperties: Record<string, any>, type: string): boolean {
if (Array.isArray(decorationProperties.type)) {
if (decorationProperties.type.indexOf(type) >= 0) {
return true
Expand All @@ -40,7 +40,7 @@ export default class Decoration {
* be displayed
* @param {Object} properties the decoration's properties
*/
constructor(marker: Marker, minimap: Minimap, properties: {}) {
constructor(marker: Marker, minimap: Minimap, properties: Record<string, any>) {
/**
* @access private
*/
Expand Down Expand Up @@ -119,7 +119,7 @@ export default class Decoration {
* when the event is triggered
* @return {Disposable} a disposable to stop listening to the event
*/
onDidChangeProperties(callback: (change: {}) => void): Disposable {
onDidChangeProperties(callback: (change: Record<string, any>) => void): Disposable {
return this.emitter.on("did-change-properties", callback)
}

Expand Down Expand Up @@ -170,7 +170,7 @@ export default class Decoration {
*
* @return {Object} the decoration's properties
*/
getProperties(): {} {
getProperties(): Record<string, any> {
return this.properties
}

Expand All @@ -180,7 +180,7 @@ export default class Decoration {
*
* @param {Object} newProperties the new properties for the decoration
*/
setProperties(newProperties: {}) {
setProperties(newProperties: Record<string, any>) {
if (this.destroyed) {
return
}
Expand Down
2 changes: 1 addition & 1 deletion lib/minimap-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,7 @@ function extractTouchEventData(touchEvent: TouchEvent) {
* @param {Object} styles the styles to apply
* @access private
*/
function applyStyles(element: HTMLElement, styles: {}) {
function applyStyles(element: HTMLElement, styles: Record<string, any>) {
if (!element) {
return
}
Expand Down
2 changes: 1 addition & 1 deletion lib/minimap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ export default class Minimap {
* @param {Object} changes a change to dispatch
* @access private
*/
emitChanges(changes: {}) {
emitChanges(changes: Record<string, any>) {
this.emitter.emit("did-change", changes)
}

Expand Down
20 changes: 10 additions & 10 deletions lib/mixins/canvas-drawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ const frontDecorationDispatcher = {
* @param {string} decorationColor decoration color
* @access private
*/
function drawLineDecoration(decoration: Decoration, data: {}, decorationColor: string) {
function drawLineDecoration(decoration: Decoration, data: Record<string, any>, decorationColor: string) {
const { context, lineHeight, canvasWidth, yRow } = data

context.fillStyle = decorationColor
Expand All @@ -833,7 +833,7 @@ function drawLineDecoration(decoration: Decoration, data: {}, decorationColor: s
* @param {string} decorationColor decoration color
* @access private
*/
function drawGutterDecoration(decoration: Decoration, data: {}, decorationColor: string) {
function drawGutterDecoration(decoration: Decoration, data: Record<string, any>, decorationColor: string) {
const { context, lineHeight, yRow } = data

context.fillStyle = decorationColor
Expand All @@ -851,7 +851,7 @@ function drawGutterDecoration(decoration: Decoration, data: {}, decorationColor:
* @param {string} decorationColor decoration color
* @access private
*/
function drawHighlightDecoration(decoration: Decoration, data: {}, decorationColor: string) {
function drawHighlightDecoration(decoration: Decoration, data: Record<string, any>, decorationColor: string) {
const { context, lineHeight, charWidth, canvasWidth, screenRow, yRow } = data

const range = decoration.getMarker().getScreenRange()
Expand Down Expand Up @@ -883,7 +883,7 @@ function drawHighlightDecoration(decoration: Decoration, data: {}, decorationCol
* @param {string} decorationColor decoration color
* @access private
*/
function drawHighlightOutlineDecoration(decoration: Decoration, data: {}, decorationColor: string) {
function drawHighlightOutlineDecoration(decoration: Decoration, data: Record<string, any>, decorationColor: string) {
const { context, lineHeight, charWidth, canvasWidth, screenRow, yRow } = data

let bottomWidth, colSpan, width, xBottomStart, xEnd, xStart
Expand Down Expand Up @@ -968,7 +968,7 @@ function drawHighlightOutlineDecoration(decoration: Decoration, data: {}, decora
*/
function drawCustomDecoration(
decoration: Decoration,
data: {},
data: Record<string, any>,
decorationColor: string,
editorElement: TextEditorElement
) {
Expand Down Expand Up @@ -997,9 +997,9 @@ function drawCustomDecoration(
*/
function drawDecorations(
screenRow: number,
decorations: {},
renderData: {},
types: {},
decorations: Record<string, any>,
renderData: Record<string, any>,
types: Record<string, any>,
editorElement: TextEditorElement
) {
let decorationsToRender = []
Expand Down Expand Up @@ -1061,7 +1061,7 @@ function drawFrontDecorationsForLines(
firstRow: number,
lastRow: number,
offsetRow: number,
renderData: {},
renderData: Record<string, any>,
lineHeight: number,
editorElement: TextEditorElement,
decorations: Array<Decoration>
Expand Down Expand Up @@ -1102,7 +1102,7 @@ function drawBackDecorationsForLines(
firstRow: number,
lastRow: number,
offsetRow: number,
renderData: {},
renderData: Record<string, any>,
lineHeight: number,
editorElement: TextEditorElement,
decorations: Array<Decoration>
Expand Down
4 changes: 2 additions & 2 deletions lib/plugin-management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ export const plugins = {}
* @type {Object}
* @access private
*/
const pluginsSubscriptions: {} = {}
const pluginsSubscriptions: Record<string, any> = {}

/**
* A map that stores the display order for each plugin
*
* @type {Object}
* @access private
*/
const pluginsOrderMap: {} = {}
const pluginsOrderMap: Record<string, any> = {}

/**
* Registers a minimap `plugin` with the given `name`.
Expand Down

0 comments on commit 6b32481

Please sign in to comment.