-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid typescript declarations #707
Comments
@jannikac would you have some time to take a look at these? |
Hi, I created a PR to address most of the issues, however I cant fix errors related to Also while I agree there are errors to be fixed, how are you seeing those errors? I can only see them while viewing the generated |
Here is how to reproduce:
|
Yeah I could reproduce. The issue was that I was testing with npm pack which creates a tarball like what is being distributed via npm. Typescript doesn't check types of imported libraries thats why you wouldn't see the issues when importing the package from npm. However, I managed to fix all the typescript errors in the previously mentioned PR, even the designSet ones. I tested with my PR and your setup and it worked with no errors! |
How do we create the typings? I installed the package and just wanted to create the typings to make my linter stop complaining. I ran
Not sure if that is how I am supposed to do it, I was just thinking that if I could read all the jsdoc in the package I could generate the type and plop it in my app. But I am getting quite a few errors
|
So typings would be included in the npm package in a future release so you wouldnt have to do anything for that. Running
Alternatively you can run |
The herein mentioned things are now addressed at #712. The comment #712 (comment) is still relevant. |
I tried the new type declarations from ical.js, originating from #662:
I do
import ICAL from "ical.js"
. The errors I get are:In dist/component.d.ts:65:
readonly get name(): string;
→ ../ical.js/dist/types/component.d.ts(65,5): error TS1024: 'readonly' modifier can only appear on a property declaration or index signature.In event.d.ts:42:
constructor(component?: Component | undefined, options: {strictExceptions: boolean; exceptions: Array<Component | Event>; });
→ error TS1016: A required parameter cannot follow an optional parameter. Indeed, component is optional, options is not.period.d.ts:41:
static fromJSON(aData: Array<string, string>, aProp: Property, aLenient: boolean): Period;
→ error TS2314: Generic type 'Array' requires 1 type argument(s).design.d.ts:10:
export function getDesignSet(componentName: string): ICAL.design.designSet;
→error TS2503: Cannot find namespace 'ICAL'.Full list of errors:
../ical.js/dist/types/component.d.ts(65,5): error TS1024: 'readonly' modifier can only appear on a property declaration or index signature.
../ical.js/dist/types/design.d.ts(10,58): error TS2503: Cannot find namespace 'ICAL'.
../ical.js/dist/types/design.d.ts(16,22): error TS2503: Cannot find namespace 'ICAL'.
../ical.js/dist/types/design.d.ts(21,23): error TS2503: Cannot find namespace 'ICAL'.
../ical.js/dist/types/design.d.ts(26,24): error TS2503: Cannot find namespace 'ICAL'.
../ical.js/dist/types/event.d.ts(42,52): error TS1016: A required parameter cannot follow an optional parameter.
../ical.js/dist/types/event.d.ts(174,5): error TS1024: 'readonly' modifier can only appear on a property declaration or index signature.
../ical.js/dist/types/parse.d.ts(26,55): error TS2503: Cannot find namespace 'ICAL'.
../ical.js/dist/types/parse.d.ts(68,59): error TS2304: Cannot find name 'Numeric'.
../ical.js/dist/types/parse.d.ts(93,129): error TS2503: Cannot find namespace 'ICAL'.
../ical.js/dist/types/period.d.ts(41,28): error TS2314: Generic type 'Array' requires 1 type argument(s).
../ical.js/dist/types/property.d.ts(16,48): error TS2503: Cannot find namespace 'ICAL'.
../ical.js/dist/types/property.d.ts(36,5): error TS1024: 'readonly' modifier can only appear on a property declaration or index signature.
../ical.js/dist/types/property.d.ts(42,5): error TS1024: 'readonly' modifier can only appear on a property declaration or index signature.
../ical.js/dist/types/stringify.d.ts(25,53): error TS2503: Cannot find namespace 'ICAL'.
../ical.js/dist/types/stringify.d.ts(38,51): error TS2503: Cannot find namespace 'ICAL'.
../ical.js/dist/types/stringify.d.ts(69,100): error TS2503: Cannot find namespace 'ICAL'.
../ical.js/dist/types/time.d.ts(221,5): error TS1024: 'readonly' modifier can only appear on a property declaration or index signature.
../ical.js/dist/types/timezone_service.d.ts(8,38): error TS1016: A required parameter cannot follow an optional parameter.
../ical.js/dist/types/types.d.d.ts(73,16): error TS2503: Cannot find namespace 'ICAL'.
The text was updated successfully, but these errors were encountered: