I'm currently using a library that was licensed under the GNU General Public License (particularly GPL v3.0). This library consists mostly of types for software that is also under the GPL (but not written in TypeScript). My code is currently written in the Apache License 2.0, which is only one-way compatible with the GPL license.

As far as I'm aware, TypeScript doesn't actually emit information about types when transpiling to JavaScript. In this case (to my knowledge), the output program never actually carries any of the original library source which is under the GPL. However, I'm still technically using those types whenever transpiling code (and likewise is marked as a dev dependency in my package.json file).

Does this mean I can keep my code licensed under the Apache License, or is this indirect relation enough to cause a GPL violation (and no longer counts as mere aggregation)? Additionally, will importing the type (through import) possibly have any difference compared to using types declared by the library in global scope (by placing the library within the tsconfig.json includes section)?

  • 1
    Are you going to publish the source code to your project in source-code form, which presumably also includes (parts of) the GPL TypeScript library? Or are you going to publish only the compiled-to-JavaScript version of your code (classically this output is called the "binary version" or "non-source form" when talking about software licenses), which presumably does not include any part of the GPLed TypeScript library? It seems likely that the answer to your question might be different for each of those choices.
    – Brandin
    Feb 21, 2022 at 10:22
  • @Brandin I'll be publishing the non-source form. Feb 21, 2022 at 12:09
  • 1
    GPL is kinda 'virus' license, using GPL licensed code into your project will infect it and your project must be licensed under GPL. So basically if you're distributing the source files then you're required to license your under with GPL.
    – Ar Rakin
    Mar 10, 2022 at 19:27


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.