typeshare icon indicating copy to clipboard operation
typeshare copied to clipboard

`const` support

Open snowsignal opened this issue 2 years ago • 3 comments

Closes #44.

This PR will allow the typeshare annotation to be used for const variables. This will copy the variable declaration into the output for the respective language.

For example:

const ANSWER_TO_EVERYTHING: u32 = 42;
const BEST_FILM: &str = "The Tree of Life";

This would become:

const ANSWER_TO_EVERYTHING = 42;
const BEST_FILM = "The Tree of Life";
class Constants {
  static let ANSWER_TO_EVERYTHING = 42
  static let BEST_FILM = "The Tree of Life"
}
const val ANSWER_TO_EVERYTHING = 42
const val BEST_FILM = "The Tree of Life"
const ANSWER_TO_EVERYTHING = 42
const BEST_FILM = "The Tree of LIfe"

As of right now, this PR only supports integers, floats, and strings as constant types.

snowsignal avatar Jan 27 '23 02:01 snowsignal

I would like to have this 👍

beyera avatar Aug 18 '23 02:08 beyera

Is this still being worked on? It seems very useful

lpi avatar Aug 25 '23 22:08 lpi

Is this still being worked on? It seems very useful

Sorry, this has been put on hold for a while. I'm no longer actively involved with this specific project but I'll try to get this merged when I can.

snowsignal avatar Aug 25 '23 22:08 snowsignal