Foundation-sites: Foundation Sites 6 Typescript Definition File

Created on 4 Jan 2017  路  14Comments  路  Source: foundation/foundation-sites

Hi all,

It's new on Foundation Sites and first time on github. I have made some modifications on typescript definition file "foundation.d.ts" and not sure here is the right place to post it. Attached is the file and hope someone just may find it useful.

Regards,

Steven
foundation-sites-6.d.zip

Most helpful comment

Hi @stcp. Welcome to Github ! 馃帀

I would advise you to create a Pull Request for Foundation.

To help you, here some guides that show how to contribute to Github projects:

After you made a pull request, Foundation maintainers will review it to ensure that everything is okay, then merge your changes.

Please feel free to ask if you need help or have any question ! :)

Nicolas

All 14 comments

Hi @stcp. Welcome to Github ! 馃帀

I would advise you to create a Pull Request for Foundation.

To help you, here some guides that show how to contribute to Github projects:

After you made a pull request, Foundation maintainers will review it to ensure that everything is okay, then merge your changes.

Please feel free to ask if you need help or have any question ! :)

Nicolas

Thanks buddy for these links. It really helped Nicolas bro

@stcp : Go for the first link if you confused within choosing !

Thanks Nicolas and IamManchanda, I will try later on :)

Heartly welcome bro ,,,,, Foundation Community and yetinauts are always there for help.

I've taken a short look on the definitions and I cant't really determine what was changed, because everything is changed so I can't see any improvement. Maybe you describe what your improvement is about.

Hi DaSchTour,

I have added some Foundation global settings, for example:

Foundation.Abide.defaults.patterns,
Foundation.Abide.defaults.validators

The original definition file wont allow me to to that. May be there is a simpler way to do it using the original but due to my limited knowledge that is the best I can do.

Regards,

Steven

I am writing some angular2 directives for Foundation Sites 6 just for learning both, after polish and cleanup the codes, I may submit to the github....

Nice to hear. Would love to see the work on angular2. In the meantime I added Abide defaults to typings ;)
Maybe you could download the updated typings from my work an verify that it works as you expected.

@DaSchTour can you help me on this https://github.com/zurb/foundation-sites/issues/9592#issuecomment-270592836 ?
Asking this as you just merged zurb:develop

{{ Sorry for refrencing an unrelated issue }}

Hi DaSchTour,

Thanks for the updated definition file.

Would it be better if variables defined within interface FoundationSitesStatic have their own factory interfaces so that extending the type definitions would be easier, just a thought.

Regards,

Steven


For example:

declare module FoundationSites{
    interface Abide{
        findRadioLabels(element:JQuery):any;
    }
    interface InterchangeFactory{  
        SPECIAL_QUERIES?:{[key:string]:string};
    }

}

@stcp I would like to keep Definitions as simple as possible and not introducing additional interfaces that have not representation in JS code.

Defining of a variable in FoundationSites as an interface is the same as the existing, but allow one to add types without modifying the original....

 Abide: {
      new(element: JQuery, options?: IAbideOptions): Abide;
      defaults: AbideDefaults;
 }

instead

interface AbideFactory{
       new(element: JQuery, options?: IAbideOptions): Abide&JQuery;

  }
Abide: AbideFactory;

If some types are missing from the installed Foundation version at the time of development, one can just add the types by defining the interface again with new types in a separate file.

say

declare module FoundationSites{
  interface AbideFactory {
        defaults?:{           
            validators?:{[key:string]:Function};
            patterns?:{[key:string]:RegExp}; 
        };
    }
}

There shouldn't be any typings missing, that's the goal ;)
So let's make the typings include everything that is available in JS.

Closing this based on the discussion in #9616

Was this page helpful?
0 / 5 - 0 ratings