Skip to content

Commit

Permalink
fix tsc problems
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed May 26, 2020
1 parent 0d5f78c commit b24753e
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 18 deletions.
2 changes: 1 addition & 1 deletion example-projects
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"ts-loader": "^7.0.4",
"tslint": "^5.16.0",
"tslint-config-standard": "^8.0.1",
"typescript": "^3.9.2",
"typescript": "^3.9.3",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"xhr-mock": "^2.5.1",
Expand Down
10 changes: 7 additions & 3 deletions packages/common/src/common/Emitter.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@

export class Emitter<HandlerFuncs extends { [eventName: string]: (...args: any[]) => any }> {
export interface HandlerFuncTypeHash {
[eventName: string]: (...args: any[]) => any // with all properties required
}

export class Emitter<HandlerFuncs extends HandlerFuncTypeHash> {

private handlers: { [Prop in keyof HandlerFuncs]?: HandlerFuncs[Prop][] } = {}
private options: HandlerFuncs
private options: Partial<HandlerFuncs>
private thisContext: any = null


Expand All @@ -11,7 +15,7 @@ export class Emitter<HandlerFuncs extends { [eventName: string]: (...args: any[]
}


setOptions(options: HandlerFuncs) {
setOptions(options: Partial<HandlerFuncs>) {
this.options = options
}

Expand Down
12 changes: 6 additions & 6 deletions packages/common/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ export interface CalendarListenerRefiners extends BuiltInCalendarListenerRefiner
// for ambient extending
}

export type CalendarListeners = RefinedOptionsFromRefiners<Required<CalendarListenerRefiners>> // Required hack

type CalendarListenersLoose = RefinedOptionsFromRefiners<Required<CalendarListenerRefiners>> // Required hack
export type CalendarListeners = Required<CalendarListenersLoose> // much more convenient for Emitters and whatnot


// calendar-specific options
Expand All @@ -329,12 +329,12 @@ export interface CalendarOptionRefiners extends BuiltInCalendarOptionRefiners {

export type CalendarOptions =
BaseOptions &
CalendarListeners &
CalendarListenersLoose &
RawOptionsFromRefiners<Required<CalendarOptionRefiners>> // Required hack https://github.com/microsoft/TypeScript/issues/15300

export type CalendarOptionsRefined =
BaseOptionsRefined &
CalendarListeners &
CalendarListenersLoose &
RefinedOptionsFromRefiners<Required<CalendarOptionRefiners>> // Required hack

const COMPLEX_CALENDAR_OPTIONS: (keyof CalendarOptions)[] = [
Expand Down Expand Up @@ -370,12 +370,12 @@ export interface ViewOptionRefiners extends BuiltInViewOptionRefiners {

export type ViewOptions =
BaseOptions &
CalendarListeners &
CalendarListenersLoose &
RawOptionsFromRefiners<Required<ViewOptionRefiners>> // Required hack

export type ViewOptionsRefined =
BaseOptionsRefined &
CalendarListeners &
CalendarListenersLoose &
RefinedOptionsFromRefiners<Required<ViewOptionRefiners>> // Required hack


Expand Down
11 changes: 9 additions & 2 deletions rollup.packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,16 @@ function transplantCss(fileName) { // fileName w/o extension

function externalizeVDom() {
return {
resolveId(id) {
resolveId(id, importer) {
if (/\/vdom$/.test(id) || id.match(/^(preact|react|react-dom)$/)) {
return { id: './vdom', external: true, moduleSideEffects: true }
if (
importer.match('packages/common') ||
importer.match('packages/core')
) {
return { id: './vdom', external: true, moduleSideEffects: true }
} else {
return { id: '@fullcalendar/common', external: true, moduleSideEffects: true }
}
}
}
}
Expand Down
19 changes: 18 additions & 1 deletion scripts/example-projects-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,24 @@ globby.sync('*', { cwd: PROJECTS_ROOT, onlyDirectories: true }).forEach(function
)

} else {
let { success } = exec.sync([ 'yarn', 'run', 'build' ], {

// tsc
if (exampleName.match('typescript')) {
let { success } = exec.sync([ 'npx', 'tsc' ], {
cwd: path.join(PROJECTS_ROOT, exampleDir),
live: true
})

if (!success) {
console.warn(`Failed running tsc in example project "${exampleName}"`)
process.exit(1)

} else {
console.log(`Succeeded running tsc in example project "${exampleName}"`)
}
}

let { success } = exec.sync([ 'npm', 'run', 'build' ], {
cwd: path.join(PROJECTS_ROOT, exampleDir),
live: true
})
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14146,10 +14146,10 @@ typescript@^3.2.4, typescript@^3.4.1, typescript@^3.8.3:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"
integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==

typescript@^3.9.2:
version "3.9.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.2.tgz#64e9c8e9be6ea583c54607677dd4680a1cf35db9"
integrity sha512-q2ktq4n/uLuNNShyayit+DTobV2ApPEo/6so68JaD5ojvc/6GClBipedB9zNWYxRSAlZXAe405Rlijzl6qDiSw==
typescript@^3.9.3:
version "3.9.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.3.tgz#d3ac8883a97c26139e42df5e93eeece33d610b8a"
integrity sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==

ua-parser-js@0.7.21:
version "0.7.21"
Expand Down

0 comments on commit b24753e

Please sign in to comment.